Cron表达 [英] Cron expression

查看:73
本文介绍了Cron表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何编写Cron表达式以每天在上午8点和下午3:30触发?
我知道如何创建一个表达式以每天触发一次,而不是多次设置。
预先感谢

How would I go about writing a Cron expression to trigger every day at 8am and 3:30pm? I understand how to create an expression to fire once a day, just not at multiple set times. Thanks in advance

推荐答案

您应该只使用两行。

0 8 * * * command
30 15 * * * command

当然,在典型的/etc/cron.d格式中,将用户作为arg 6包含在内。表达式符号(在我所知道的所有版本中)将为您提供除所需内容之外的其他内容(例如,表达式本质上是可加的,因此它将比您想要的运行更多。)

Of course in typical /etc/cron.d format, include the user as arg 6. Expression notation (in all the versions I know of) will get you something other than what you want (e.g. the expressions are additive in nature, so it will run more than you want).

这篇关于Cron表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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