[plug] Redirecting Web Data

Matt Kemner zombie at wasp.net.au
Thu May 25 22:56:55 WST 2000


On Thu, 25 May 2000, Mike from West Australia wrote:

> >wget http://url.goes.here/ -O file.txt
> 
> Question: Is there a way to handle username/passwords with a preset
> number of retries (rather more then 3).

Some simple bash scripting will do what you want

eg:

#!/bin/bash
count=0
limit=5
wait=5
while true
do
  echo Attempt: $count
  wget http://user:pass@www.website.com/url.html && exit
  sleep $wait
  count=$(($count+1))
  if [ $count -eq $limit ]
  then
    exit
  fi
done

change user & pass to the username/password for the site, and the rest of
the URL as appropriate. change limit to the number of retries. These can
all easily be replaced by command line variables so you can use the same
script for multiple sites.

 - Matt

P.S. It could probably be done in a much easier/neater way.
     my bash coding is not as good as it used to be.  




More information about the plug mailing list