如何设置 cron 作业在准确的时间运行? [英] How to set a cron job to run at a exact time?
本文介绍了如何设置 cron 作业在准确的时间运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个每天运行一次的 cron 作业.但我想让它在午夜或其他确切时间运行.
I have a cron job that runs once a day. But I would like to make it run at midnight or other time exactly.
推荐答案
您还可以为每个 gr 指定确切的值
You can also specify the exact values for each gr
0 2,10,12,14,16,18,20 * * *
0 2,10,12,14,16,18,20 * * *
它代表 2h00、10h00、12h00 等等,直到 20h00.
It stands for 2h00, 10h00, 12h00 and so on, till 20h00.
从上面的答案,我们有:
From the above answer, we have:
逗号,"的意思是和".如果您对上面的行感到困惑,请记住空格是字段分隔符,而不是逗号.
The comma, ",", means "and". If you are confused by the above line, remember that spaces are the field separators, not commas.
来自(维基百科页面):
* * * * * command to be executed
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
希望有帮助:)
--
- 不要错过第一个 0(零)和后面的空格:它的意思是零分钟",您也可以将其设置为 15(第 15 分钟)或类似 */15(每分钟可被 15 整除)的表达式, 即 0,15,30)
这篇关于如何设置 cron 作业在准确的时间运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文