[wellylug] Bash script not working all the time
mail.list at pro.geek.nz
Fri Sep 16 23:51:30 NZST 2011
On Fri, 2011-09-16 at 11:45 +1000, Peter Lynch wrote:
> Hi everyone,
> I have the following bash script which works, i.e. touches the
> specified file, when I run it from the command line, but not when it
> is run from cron. Does anyone know why?
It's because cron in most cases runs under /bin/sh with minimal
"Several environment variables are set up automatically by the cron(8)
daemon. SHELL is set to /bin/sh, and LOGNAME and HOME are set from
the /etc/passwd line of the crontab�s owner. HOME and SHELL may be
overridden by settings in the crontab; LOGNAME may not."
Set your PATH inside your cron script, and it should all be good.
I like to set a MAILTO value also
More information about the wellylug