crontab won't run script with absolute path

Eric Donkersloot eric.donkersloot at gmail.com
Wed May 3 09:47:18 UTC 2006


Hi,

I presume root is running the cronjob ? Try and put the following on top of
the script:

#!/bin/bash --login


On 5/3/06 11:22 AM, "Cameron Beattie" <kjcsb at orcon.net.nz> wrote:

> 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 

Met vriendelijke groeten / Kind regards,

Eric
-- 
Eric Donkersloot
Amsterdam, The Netherlands
eric.donkersloot at gmail.com





More information about the users mailing list