* * * * * . /etc/profile && domystuff
instead of
* * * * * domystuff
that way you get all the environment as set up in /etc/profile
Keven Ring wrote:
duncan brown wrote:
matt,
you want to create a wrapper script, OR have the export of your http_proxy
var on your crontab line seperated from your command by an ; or &&
; means that it'll run the following command whether or not the first one succeeded && means that it'll only run it if the previous command completed successfully
if this is for apt (apt-get / apt-cache), then you can modify the apt.conf
file (do a search for the word proxy) and you can set it up in there and
be set.
now, you could also create a wrapper script
create /usr/local/bin/my_wrapper (or whatever you want to call it)
Matthew Benjamin said:
Can someone tell me how to create a system variable. For instance I would like to create a variable called http_proxy that will be available for a cronjob. This requires the variable to be available to the process when no one is logged in. Export does not work because it disappears when you log off. editing the /etc/profile file to include this does not work because the variable is created as an environment variable and only exits while you're logged on. That's my dilemma. Please help.
mattB.
Even easier is to do a man 5 crontab. This tells you how to supply environment variables inside of the crontab file!
No wrapper needed! Of course, that environment variable is then passed to every program, but http_proxy sounds like a good one to pass on....