PDA

View Full Version : Crontab Network Proxy



ElectronicMaint
22nd January 2008, 09:11 AM
i am trying to get crontab to use the wget command , my crontab file is ok tested on several computers. the problem seams to be the computer that runs this cron job is connected to the internet via a proxy

it would appear that i need to set the network proxy settings for the crontab user any ideas how

thanks

shamblett
22nd January 2008, 10:42 AM
The wget man page shows how to use the --proxy options, however, have a read of this :-

http://blog.taragana.com/index.php/archive/how-to-use-wget-through-proxy/

Its a bit clearer.

ElectronicMaint
22nd January 2008, 03:26 PM
ok made some progress with that but cron still dies , but if i ssh in now i can run wget commands .
what i really need is the simpletons "how to set system wide envoirment thingies"
have see how to configure yum to use a proxy for all users , but not wget
if it is of any help it is fedora 7

shamblett
22nd January 2008, 04:33 PM
OK, can you move the wget out of the crontab and into a script? ie call a script from the crontab or dont use crontab at all and place the script in /etc/cron.daily where it'll be run daily by run parts. This of course doesnt help if you want better timing than this.

You can call the script from crontab, in it set the proxy env vars for wget and call the wget command as youve found.

eg for example replace '0 3 * * * * /usr/bin/wget.........................................'

in the crontab with '0 3 * * * /path/to/mywgetscript'

then in your mywgetscript set the env vars

!#/bin/bash
wget_proxy=xyz
wget ..............

sorry dont know the exact variables to set here but man wget will help hopefully.

To be more system wide you could put the wget_proxy vars in users .bashrc's or in /etc/profile for real system wide stuff if you want all users to do this.

ElectronicMaint
22nd January 2008, 06:44 PM
/etc/wgetrc looks like the baby for me have another go tomorrow

thanks for the pointers

you may get nagged again

shamblett
22nd January 2008, 09:04 PM
Yes, just had a quick look at it, well spotted, didnt know wget had its own global conf file