Web Hosting Forum | Lunarpages

Author Topic: Cron running on GMT?  (Read 16005 times)

Offline hairboy

  • Intergalactic Cowboy
  • *****
  • Posts: 57
  • If all else fails, become a dolphin
    • Track King
Cron running on GMT?
« on: August 25, 2011, 10:33:39 PM »
Hey,

I know that there are options when setting up CRON on the server to run CRONs based on GMT.

Is it possible to do this with LPCP on a shared hosting environment?
I'm guessing I can't login via shell to set it up.... are there any ways to trigger it within the web interface?

If not.....any other suggestions? (Aside from remembering to adjust the CRON twice a year for daylight savings!   :hypno:

Offline hairboy

  • Intergalactic Cowboy
  • *****
  • Posts: 57
  • If all else fails, become a dolphin
    • Track King
Re: Cron running on GMT?
« Reply #1 on: August 28, 2011, 07:11:00 PM »
OK......what I'm going with for now is that I will have the CRON run every hour of the day, and if the time is the correct day/time GMT then it will execute, otherwise it will silently exit.

I would really appreciate if anyone can offer a better alternative - particularly how to setup CRONs to run on GMT triggers instead of local server time (assuming the shared hosting & LPCP constraints)

Offline lonniefilkins

  • Pong! (the videogame) Master
  • *****
  • Posts: 27
Re: Cron running on GMT?
« Reply #2 on: February 28, 2012, 10:23:19 PM »
I think  you need to convert your server time to GMT and specify it in cron jobs. There is no direct method to select GMT.

____________
<spam link removed>
« Last Edit: April 19, 2013, 09:20:15 AM by MrPhil »

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6226
Re: Cron running on GMT?
« Reply #3 on: March 29, 2012, 09:28:02 AM »
If you're on a shared server, you will not be able to change the system clock or time zone. The best you can do is set your desired (GMT) cron event time to the server's time zone (PST/PDT for Lunarpages), provided you don't mind a one hour offset part of the year. If this is unacceptable (it absolutely has to be at the same GMT each day), you could trigger on both the hours (2 per day) and pick whichever one is the correct GMT (depending on whether DST is in effect). That would be a little less load on the server than running cron hourly.

VPS might be able to run on GMT. Dedicated servers probably can.
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

Offline gingir

  • Newbie
  • *
  • Posts: 4
Re: Cron running on GMT?
« Reply #4 on: May 31, 2013, 10:36:43 PM »
If you're on a shared server, you will not be able to change the system clock or time zone. The best you can do is set your desired (GMT) cron event time to the server's time zone (PST/PDT for Lunarpages), provided you don't mind a one hour offset part of the year. If this is unacceptable (it absolutely has to be at the same GMT each day), you could trigger on both the hours (2 per day) and pick whichever one is the correct GMT (depending on whether DST is in effect). That would be a little less load on the server than running cron hourly.

VPS might be able to run on GMT. Dedicated servers probably can.

I am trying to achieve the same as hairboy ... however I don't know how/where do I set the cron?

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6226
Re: Cron running on GMT?
« Reply #5 on: June 01, 2013, 05:10:10 AM »
You can either:
  • Set the cron job to run at the correct PST/PDT time, and update it twice a year as the system goes on and off DST, or
  • Set a script (Bash, PHP, Perl, etc.) to run at both PST and PDT (twice a day, one hour apart). Within the script, determine GMT and pick one of the two runs (the one at the proper GMT) to actually do whatever you want done. Set a flag to ensure you don't run the job twice in one day when the clocks change.
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

 

Share |