[lug] cron question
walter at frii.com
Tue Oct 24 11:33:31 MDT 2000
On Tue, 24 Oct 2000, Ken Kinder wrote:
> I think the reason is security/clarity. "echo" won't work because it's
> not a command, it's s shell command.
> On Mon, Oct 23, 2000 at 02:34:19PM -0600, Michael Wegener wrote:
> > Hello everybody,
> > Does cron need a full path specified for commands? I run cron with a
> > mixture of scripts (where I specify the full path and which run fine)
> > and PATH-resident commands that can be run from the command line (i.e.
> > echo and sitecopy). All show up in the cron logs, but "sitecopy" and
> > "echo" never run and I can't figure out why there should be a
> > difference. Any ideas what I'm missing?
> > --M
Cron jobs run under their own environment, which may or may not
match that of $USER. The quick and dirty sulution is to specify
a full pathname for your commands, if they're not being found.
Also, you can get some flaky behavior if you're depending on some
feature in a shell builtin (echo is common). And feature x is in sh and
ksh but not in csh; and this other thing is in sh and csh but .... yuk.
Again, better to use /usr/bin/echo or /usr/ucb/echo explicitly, and you'll
know *exactly* what cron is using.
The other way to do this is to man cron and find out which file is
used to set cron's environment. Change $PATH there.
More information about the LUG