[CentOS] crontab problems

Mon Feb 20 20:50:00 UTC 2006
Will McDonald <wmcdonald at gmail.com>

On 20/02/06, rado <rado at rivers-bend.com> wrote:

> if there is any kind of problem, where it cannot complete it's job(bu-
> snap.sh) it does msg me. ...no msgs from it.
> oh ya...crond is running and /var/log/messages and cron are plum full or
> crond input. bu-snap.sh writes to ../log/messages when it starts and
> when it finishes... but in this box, says nothing and, of course, it
> doesn't even run as I can tell.
> this sucker has me stumped... and also...lots of other stuff in the logs
> of chrond running root stuff so it's not a problem of not running root
> stuff.

Is /usr/bu-snap/bu-snap.sh executable by root? i.e. is it owned by
root and executable by its owner or owned by some other user but
executable by other, if you see what I mean? So, either...

-rwxr--r--  1 root root 0 Feb 20 20:45 bu-snap.sh
or
-rwxr--r-x  1 wmcdonald wmcdonald 0 Feb 20 20:45 bu-snap.sh

I also notice, from the format, this is /etc/crontab rather than a
user crontab, yes? If that's the case then perhaps the freshclam
command before bu-snap.sh is causing the problem. The freshclam job
you've listed doesn't have a user to run as specified.

> 42 4 1 * * root run-parts /etc/cron.monthly
> 05 * * * * /usr/bin/freshclam

Shouldn't that be...

> 42 4 1 * * root run-parts /etc/cron.monthly
> 05 * * * * root /usr/bin/freshclam

So, it could well be that crond's choking before getting to bu-snap.sh.

I like to include the following header in user crontabs just as a
reminder of the formatting (for other users, obviously :)) ...

# minute (0-59),
# |      hour (0-23),
# |      |       day of the month (1-31),
# |      |       |       month of the year (1-12 or Jan-Dec),
# |      |       |       |       day of the week (0-6, 0=Sunday, or Sun-Sat).
# |      |       |       |       |       commands

For /etc/crontab you could have something similar...

# minute (0-59),
# |      hour (0-23),
# |      |       day of the month (1-31),
# |      |       |       month of the year (1-12 or Jan-Dec),
# |      |       |       |       day of the week (0-6, 0=Sunday, or Sun-Sat).
# |      |       |       |       |      user to run as
# |      |       |       |       |      |       commands