Dec 16 2006

Cron runs are off by x hours


Categories:

Cron Runs Are Off By Several Hours

Do you have a cron-based Drupal event that is off by several hours? Your problem is most likely not with your date settings, as I first suspected when I encountered this problem with the "Recent Popular Content" block resetting at an odd time (5 hours too early, as I wanted it to reset at midnight every night). Rather, it may have to do with cronplus settings.

Adjusting Cronplus Time Settings

If you have cronplus installed, you can go into admin -> settings -> cronplus, and under "preferred hour" pick an hour that will negate the time offset you are experiencing. For example, in my case my recent popular content block was resetting 5 hours too early, which means to cronplus it was firing off at what it presumed was midnight. Therefore, if cronplus reset the popular content block 5 hours late, it would in fact be resetting it at midnight my time, which is what I wanted.

Checking Cronplus Offset

You can verify the offset in your cronplus logs (admin -> logs -> cronplus messages). You'll notice an entry like the following:

cronplus | 2006-12-16 18:59 | Processing hourly cron for 2006-12-16 22:59:51 UTC, ... | Anonymous

What this tells me is that the cronplus event scheduled to fire off at 23 UTC, actually occured at 19 EST (my time zone), which does not account correctly for the timezone difference (there's 5 hours difference between UTC and EST, not 4). This means my server time is one hour different from my actual time zone. You can verify this by running the PHP date() function and having it return the timezone.

No votes yet
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

Captcha
This question is used to make sure you are a human visitor and to prevent spam submissions.
Copy the characters (respecting upper/lower case) from the image.