如何创建 cron 语句以运行多个小时 [英] How to create cron statement to run for multiple hours
问题描述
我需要一个 cron 语句来运行几个小时,例如 1-8 然后是 10-15.在这种情况下,以下语句是否有效,
I need a cron statement to run for few hours eg 1-8 then 10-15. In this case will the following statement work,
0 1-8,10-15 * * *
如果没有,谁能帮帮我?
If not can anyone help me?
提前致谢,格尼克
推荐答案
你不能,你可以使用多个值或一个范围
You cannot, you can use either multiple values OR a range
0 1,2,3,4,5,6,7,8,10,11,12,13,14,15 * * *
来源:
时间标签用空格分隔.不要在标签内使用空格,这会混淆 cron.所有五个标签都必须存在.他们是一个彼此的逻辑与.最后一个之间还有一个空格时间标签和第一个命令.
Time tags are separated by spaces. Do not use spaces within a tag, this will confuse cron. All five tags must be present. They are a logical AND of each other. There is another space between the last time tag and the first command.
时间标签可以是通配符*",表示全部".它可以是一个值、多个值、一个范围或一个小数范围.
A time tag can be a wildcard "*", which means "all". It can be one value, several values, a range, or a fractional range.
这篇关于如何创建 cron 语句以运行多个小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!