[lug] Scripting question

Zan Lynx zlynx at acm.org
Thu Dec 20 20:42:23 MST 2012


On Thu, 2012-12-20 at 20:10 -0700, Davide Del Vento wrote:
> I suspect the issue is that cron jobs do not get the same enviroment
> that a login shell does. You'll probably have to source
> the /etc/profile or something like that as first thing in the cron
> job. You might try
> 
> 
> env > env.txt
> 
> 
> both in login and in a cron job job and then diff'ing the difference.

A habit I made long ago is to set all the environment variables at the
top of cron scripts. Look at your environment with printenv. It takes
practice to learn some of the important ones but they are in my opinion
PATH and LANG. HOME and USER can also be very important but I hope your
cron environment is setting those. I like to set LANG=C but you may need
Unicode so your mileage may vary.


-- 
Knowledge Is Power
Power Corrupts
Study Hard
Be Evil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20121220/9196dfe0/attachment.pgp>


More information about the LUG mailing list