在每个时区的凌晨12点运行cron作业 [英] Run cron job at 12 am in every time zone
本文介绍了在每个时区的凌晨12点运行cron作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我认为每个时区之间大约有30分钟的间隔。我想在每个时区的上午12点(午夜)运行脚本 cron.php
。我该怎么做?
So I think there is around 30 minutes between each time zone. I want to run my script cron.php
for at 12 am (midnight) for every time zone. How can I do this?
我在看这段代码:
TZ=UTC
* 7 * * * root date | mail root
TZ=CEST
* 7 * * * root date | mail root
TZ=PCT
* 7 * * * root date | mail root
这项工作吗?
任何代码是什么意思?
还有更好的解决方案吗?
Any better solution?
推荐答案
大多数时区相隔1个小时,但有一些例外。
上面的代码将在列出的每个时区的上午7点运行。
Most time zones are 1 hour apart, with a couple of exceptions. The above code will run at 7 AM in each of the time zones listed.
最好让脚本每小时运行一次,然后在您自己的时区将其启动一次
It might be better to have a script that runs every hour and just kick that off once in your own time zone
这篇关于在每个时区的凌晨12点运行cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文