Click to See Complete Forum and Search --> : variables not being set when CRON is ran
jdvilla
07-01-2005, 12:33 PM
I have a shell scripts which emails a result to myself.
If I run it manually, everything is fine
when I run it from CRON, the file executes, but the variables are not set/saved, except for an array with email addresses...
any ideas?
is it run from your own personal cron or from the /etc/crontab?
what does the script look like?
what does the line in your crontab look like?
jdvilla
07-01-2005, 03:23 PM
thanks for the reply. the problem was that my path different when running CRON. It was failing on a command to jmeter (which was calling java and assuming it was in my path) so I just emailed myself the output and noticed that. Should have done that from the beginning
bwkaz
07-01-2005, 06:11 PM
Sounds like it may have been the old login/interactive shell vs. non-login but interactive shell vs. non-interactive shell stuff again.
Normal shells are interactive, and are also either login shells or non-login shells. (The difference is which file gets executed at startup.)
But cron usually runs your program in a non-interactive shell, which does something different than both login and non-login shells at startup (perhaps it doesn't read any of your startup files?). That's why the $PATH was not set -- the shell startup files usually set it for you, and they don't get executed from cron, like you'd expect.
Hopefully that explains why it was doing what it was doing. :)
jdvilla
07-02-2005, 11:17 AM
Thanks for the explaination. Something to remember when throwing shell scripts into CRON.