Score:0

Run cron job in UTC when my server is in a different timezone

cn flag

My server runs in the GMT timezone, which means it switches to British Summer Time in the summer.

I want a cron job to run in UTC as it accesses an external service that runs in that timezone.

i.e. In the winter, my job should run when the server time is 1am (GMT = UTC) and in the summer at 2am (GMT is ahead of UTC one hour).

I do not want to change the server to use UTC for its timezone, as other jobs run according to local time. N.B. The job I run at 1am doesn't itself access time info so doesn't need to know what timezone it's running in. It just needs to run at a UTC time.

Score:0
us flag

The easiest approach would be a wrapper script that checks local time and then executes the actual job appropriately. The corn entry would be the wrapper script, and you’d want to run it hourly for the time period to account for variance.

Julian7 avatar
cn flag
Thanks. Since no one else has answered, I'll have to assume that's it. A bit clunky but I guess it'll work.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.