HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   CRON daily jobs do not run (http://www.howtoforge.com/forums/showthread.php?t=60027)

cbj4074 21st December 2012 17:36

CRON daily jobs do not run
 
I have many identically-configured servers. All run Ubuntu 10.04.

On one particular server, I noticed that none of the daily CRON jobs appear to be running. (I assume that the weekly and monthly jobs are not running, either.) These jobs did run at some point in the past, but they stopped running one day.

The "cron" process is definitely running:

Code:

# ps -ef|grep cron
root      1360    1  0 Nov12 ?        00:00:48 cron
root      3232 26106  0 08:04 pts/1    00:00:00 grep --color=auto cron

And other CRON jobs that I have created myself do indeed run on schedule.

The daily CRON job, which is scheduled to run at 06:25, looks like this:

Code:

/etc/cron.daily/logrotate
/etc/cron.daily/sysklogd
/etc/cron.daily/rkhunter
/etc/cron.daily/ntp
/etc/cron.daily/amavisd-new
/etc/cron.daily/apache2
/etc/cron.daily/apt-show-versions
/etc/cron.daily/spamassassin
/etc/cron.daily/webalizer
/etc/cron.daily/apt.dpkg-dist
/etc/cron.daily/roundcube-core
/etc/cron.daily/00logwatch

I can see that the job is called at the correct time, as the following log entry is created:

Code:

Dec 21 06:25:01 example CRON[22303]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
However, executing this command seems to do nothing:

Code:

# test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
On another server where this works as it should, executing this command takes several minutes to complete. On the "broken" server, this command completes immediately.

However, if I execute just the latter bit of the command, the server churns-away for several minutes and the daily CRON jobs seem to complete successfully:

Code:

# cd / && run-parts --report /etc/cron.daily
Does this tell us anything useful?

What should I check to determine what's happening here?

Thanks for any help!

UPDATE:

I can't make sense of the fact that

Code:

# test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
causes absolutely nothing to happen on the system, while

Code:

# cd / && run-parts --report /etc/cron.daily
seems to work as expected. I half expected the exit status from the "test" command to be non-zero, but, alas, it is zero:

Code:

# test -x /usr/sbin/anacron
# echo $?
0

This yields zero exit status, too:

Code:

# test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
# echo $?
0

Update 2

Ahhh. I overlooked the fact that "A || B" is shell syntax for execute B only if A failed (and not only if A succeeded).

So, the fact that "test -x /usr/sbin/anacron" returns exit code zero (0) means that the second command, "( cd / && run-parts --report /etc/cron.daily )", will never be executed!

This lead me to check the exit status of "test -x /usr/sbin/anacron" on one of the systems on which this problem does not exist, and sure enough, the exit status is one (1).

It finally occurred to me that anacron must be installed on the server on which daily/weekly/monthly CRON jobs fail to be executed, and not installed on the servers that function as expected.

Surely enough, that was indeed the case. So, I uninstalled anacron, and all is well. Not sure how that bugger was installed in the first place.


All times are GMT +2. The time now is 16:51.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.