Schedule Jobs Using Crontab

Filipe Bonjour fbonjour at urbanet.ch
Wed Nov 16 07:03:11 UTC 2005


Hi,

> SHELL=/bin/sh
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/hzs202/bin
>
> # m h dom mon dow user  command
> 10,20,30,40,50 * * * *  test -x /usr/sbin/anacron || run-parts --report
> /home/hzs202/bin/sig

Here's my /etc/crontab, less a few comment lines:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || run-parts --report
/etc/cron.daily
47 6    * * 7   root    test -x /usr/sbin/anacron || run-parts --report
/etc/cron.weekly
52 6    1 * *   root    test -x /usr/sbin/anacron || run-parts --report
/etc/cron.monthly

Looks to me like the 6th field should be the user, not the script name.
Here's a couple of lines I added to the crontab on another box that work
fine:

#
00 *    * * *   root    /bin/sh /srv/nfs/secureit.sh          >/dev/null
2>/dev/null
03 *    * * *   root    /bin/sh /srv/nfs/Debian/buildother.sh >/dev/null
2>/dev/null

(Yes, I purposefully discard the output.) I guess you got the format for
the crontab line in th emanpage, which should OK for personal crontabs,
not the one in /etc. I think your cron is trying to run a command "-x"
as a user "test".

By the way, if this is your /etc/crontab, you're missing the lines I've
got, to run commands out of /etc/cron.monthly/daily/hourly. They are
sometimes important.

Fil





More information about the ubuntu-users mailing list