如何创建cron语句以运行多个小时 [英] How to create cron statement to run for multiple hours

查看:216
本文介绍了如何创建cron语句以运行多个小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个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? Its urgent

提前感谢,
Gnik

Thanks in advance, Gnik

推荐答案

您不能,您可以使用多个值或范围

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。所有五个标签必须存在。他们是一个
逻辑AND彼此。在最后的
时间标签和第一个命令之间有另一个空格。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆