[PLUG] Dumb script question
Neal
nsedell at gmail.com
Mon Apr 19 05:12:08 UTC 2010
> The big trick with cron is that it doesn't have a normal env so you
> tend to have to use full paths to everything, or manually set the
> environment prior to running the command. It's also tricky debugging
> because you don't get to tell it to run now. You usually have to set
> the frequency of how often it runs really low until you figure it out.
A useful trick whenever you're invoking executables in an unknown
environment is to simply run env and redirect it to a file.
When I run the cron command setup as
* * * * * env > mycrontab.env
using crontab I get the following in a file named mycrontab.env in my
home directory on a Ubuntu 8.04LTS box:
HOME=/home/neals
LOGNAME=neals
PATH=/usr/bin:/bin
SHELL=/bin/sh
PWD=/home/neals
Not a lot there, eh?
How you hook sudo into all of this is an exercise left to interested
parties. ;)
FYI,
NealS
More information about the PLUG
mailing list