> Date: Tue, 27 Jul 2004 15:35:31 -0700
> From: elemint@theriver.com
> To: PLUG <plug-discuss@lists.plug.phoenix.az.us>
> Subject: cron jobs not running as root
> Reply-To: plug-discuss@lists.plug.phoenix.az.us
>
> I have created a cron job and while logged in as root the scipt runs
> fine but if I configure crontab like contab -u root -e the job does not
> run.
>
> I do see the job start in /var/log/syslog
>
> The way that I know the job does not work sucessfully is becuase part of
> the job is to send out an email and that is not working unless running
> it at the command prompt as root.
>
> Jim
Hello Jim,
As pointed out earlier, the environment the cronjob is executed in is
different than when the script manually.
More often than not, paths to the binaries in your script are not in
the PATH environment when executed under crontab.
If you crontab entry is just a list of commands all piped together you
can implicitly set the path to the binaries:
ie. if your crontab command is:
whois mydomain | mail dude@inter.net
and whois is in /usr/bin and mail is in /bin then change that to
/usr/bin/whois mydomain | /bin/mail dude@inter.net
Alternatively, if the script is in it's own file, just set up the PATH
variable at the top of the script file to make sure all the necessary
binary paths are in that variable.
Darin
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss