#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    165
    Rep Power
    11

    Unscheduled cron job running with no record


    Hello,

    I've been digging through the tubes and pipes of the internet to try to find an answer, but haven't had any luck.

    My server is Ubuntu 10.04 64bit, fully up to date.

    The problem is that a cron job is running when it's not scheduled to. It's supposed to run on the first of the month, but it's been running on the 20th as well.

    The line for it in the root (and only) crontab is:
    00 07 1 * * php -f /var/w...

    All other cronjobs run at their assigned schedules.

    I first checked the system/software date and hwclock to see how far out of sync they were. The hwclock was 5 days behind, so I set it using

    hwclock --systohc

    which corrected the hwclock, but that didn't help. The cron still ran on the wrong day. Interestingly, the date it ran was 5 days later than the (incorrect) date it ran on in the previous month, which was the 15th.

    Also, there is no log of it running in /var/log/syslog. All other cronjobs are logged there, though. The job sends me a spreadsheet report, so I always have a record of when it runs. To make sure, I grepped all in /var/log to see if it turned up somewhere else - it didn't.


    Thanks everyone. This is driving me nuts!

    Mike
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,443
    Rep Power
    4539
    I'd wrap the command in a script that also logs when the script started and ended (in my own logfile). Maybe that will give an idea of when the job is run.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. D'oh!
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Location
    East Coast
    Posts
    75
    Rep Power
    73
    If your clock isn't staying in sync, perhaps you should set the system to use ntp. Once you have the right time, you should restart your cron daemon.

    There's nothing in cron that tells it to log anywhere (unless yours is configured otherwise). Logging is completely up to the called routines. That said, I'd look at wherever php is configured to log on your system. A lot of times it logs to the default apache logs, even when being run from the cli.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    165
    Rep Power
    11
    thanks. All cron jobs are logged to syslog. I added some logging to this particular php script as well.

    After I set the hwclock a few weeks ago, I restarted the cron daemon and figured that it would use the newly set time.

    Guess I'll just have to watch that new log to see what shows up next month.

    In the meantime, I'll get the server using ntp. Not sure why it isn't.

IMN logo majestic logo threadwatch logo seochat tools logo