[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is the different between cron executing and shell execution?



 <h.wulff> writes:


> All variables are defined in the header of this script.
> and LOG2SYSLOG looks like this:

i don't know those. But cron have a few differences with a regular shell.

It use "sh" to execute the scripts thus it s an interactive shell, but it don't
have the environment comming from a console login (/etc/profile and the like)
nor the one from a Xsession.
PATH is the most often encountered problem in the cron context : check by
replacing your program call by the full path to the executable :
example:
basename by /usr/bin/basename.

Most scripts which are used in different contexes and different platform use:
BASENAME=$(which basename).
PS: Some do this to avoid crackers by checking that the full path is correct
(/usr/bin/program or /bin/program), so i am not sure it is required for scripts
to work in your cron .

Cheers
Alban





Reply to: