Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

javascript - Cron job every day at 2am EST

How would I go about scheduling a cron tab every night at 2AM EST time?

It's my impression that the cron schedule below will run at 2AM UTC not EST. Is that correct?

enter image description here

Going further: to add to this, how could I have the cron schedule run at 2AM on each of the six US timezones?

question from:https://stackoverflow.com/questions/65649729/cron-job-every-day-at-2am-est

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's my impression that the cron schedule below will run at 2AM UTC not EST. Is that correct?

Yes, cron job will run on UTC time.

So to register cron on 2 AM EST you have to convert that time into UTC, and the time is in 24-hours clock

EST:

New York, NY, USA ( EST UTC-5) 2 AM

Diff from UTC is -5

UTC

In UTC time will be ( 7 - 5 = 2 EST ) 7AM

CRON at 0 7 * * *

and for multiple 2AM US timezone first watch for diff and register cron on that UTC.

also, watch for daylight savings


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...