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

crontab won't run script with absolute path



I am experiencing a strange problem where crontab won't run a script when I specify the full path to it.

whereis logrotate
logrotate: /usr/sbin/logrotate /etc/logrotate.conf /etc/logrotate.d /usr/share/man/man8/logrotate.8.gz

crontab -l
02 21 * * * logrotate /usr/share/mysql/mysql-log-rotate

In this case the crontab doesn't run because of a path issue.
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

/bin/sh: logrotate: command not found

crontab -l
02 21 * * * /usr/sbin/logrotate /usr/share/mysql/mysql-log-rotate

In this case the script is not run at all. No errors are reported in the logfile.

I'm sure there's an easy fix for this other than a symlink to /usr/sbin/logrotate?

Any advice appreciated.

Regards

Cameron
[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]