Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 21st December 2012, 17:36
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 392
Thanks: 29
Thanked 58 Times in 50 Posts
Default 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.

Last edited by cbj4074; 21st December 2012 at 22:20. Reason: Added that executing "cd / && run-parts --report /etc/cron.daily", directly, allows scripts to run.
Reply With Quote
Sponsored Links
Reply

Bookmarks

Tags
cron, daily

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in using : perfect-server-ubuntu-12.10-apache2-bind-dovecot-ispconfig-3, rezabagheri Installation/Configuration 7 30th October 2012 22:55
Cron jobs not getting run 99miles General 3 29th February 2012 23:16
Problem getting cron job to run and in need of help :) MrCompTech General 7 27th July 2010 09:50
Companion Script #2 for The Perfect Server - Fedora 13 x86_64 [ISPConfig 3]" MrCompTech Tips/Tricks/Mods 0 10th July 2010 05:11
ISPConfig cron jobs mphayesuk General 3 30th August 2009 11:15


All times are GMT +2. The time now is 18:31.


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