Michael Bevilacqua on 30 Jul 2007 17:21:10 -0000


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

Re: [PLUG] Problems with cron running daily/monthly jobs




On 7/30/07, Michael Bevilacqua <michael@bevilacqua.us> wrote:
On 7/30/07, Mark Baker <mark.baker@hxti.com> wrote:

I have been having problems with cron running the jobs in my /etc/cron.daily directory lately.  The error the cron sends me is "/bin/bash: root: command not found".

Has anyone had the same problem?  I haven't been able to track down the problem.



I would start by looking at your /etc/crontab to see if that file is setup incorrectly. It should look something like:

 
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0  *  * * *     root    rm -f /var/spool/cron/lastrun/cron.hourly
1  3  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily
15 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly
30 5  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly
*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons


The position of `root` in this file is important as it tells cron as which user to run the job as.


--
Michael D. Bevilacqua
michael@bevilacqua.us

Not to reply to my own post ;-)  but Gentoo's crontab syntax example might upset some people on this list. I'll instead, post a Redhat example, which is more traditional:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly


--
Michael D. Bevilacqua
michael@bevilacqua.us
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug