CRON daily jobs do not run

Discussion in 'Server Operation' started by cbj4074, Dec 21, 2012.

  1. cbj4074

    cbj4074 Member

    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:

    # 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:

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

    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:

    # 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:

    # 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!


    I can't make sense of the fact that

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

    # 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:

    # test -x /usr/sbin/anacron
    # echo $?
    This yields zero exit status, too:

    # test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    # echo $?
    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: Dec 21, 2012

Share This Page