thumbtackthief
thumbtackthief

Reputation: 6211

Cron job not running

This is my first time working with most of these moving parts, but...

I'm trying to get our logrotate file to run once per day to rotate the catalina.out file (it's getting too big and crashing). I'm following this tutorial, which seems pretty straightforward.

If I manually run the command listed in the tutorial: /usr/sbin/logrotate /etc/logrotate.conf then it seems to correctly create a new log file that's stamped with the current date.

In my /etc/cron.daily folder is a script (was already there) that looks like this:

#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0  

So, it looks like that command is the same one that I run manually. If I understand correctly, that means that every night the script should run. But it's not. Is there something else I need to do?

Upvotes: 0

Views: 321

Answers (1)

Thenob
Thenob

Reputation: 36

check the permissions of the script in cron.daily (should be at least 755).

If this is OK, check that cron is running by doing as root: ps auxww|grep cron (there should be at least a proces with crond or anacron)

If that is running check that cron.daily, this depends on what distribution you are running. For debain: look in /etc/crontab For slackware: crontab -l

Upvotes: 2

Related Questions