运行3次cron作业(例如8:30 AM,5:30 PM和11:30 PM)? [英] Running a cron job 3 times (8:30 AM, 5:30 PM and 11:30 PM for example)?

查看:656
本文介绍了运行3次cron作业(例如8:30 AM,5:30 PM和11:30 PM)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定每天如何在3个特定小时执行cron作业.我想在上午8:30,下午5:30和晚上11:30运行它

想法可能如何工作?

I am not sure how to run a cron job at 3 specific hours every day. I want to run it at 8:30 AM, 5:30 PM and 11:30 PM

Ideas how that might work? Is it possible at all in one expression?

推荐答案

不,没有数学(至少没有我能想到的简单数学)允许从8:30开始AM到5:30 PM,然后11:30 PM.
但是没有什么可以阻止您在cron表中输入三个条目.
No, there is no math (at least no simple one I can think of) allowing to go from 8:30 AM to 5:30 PM then 11:30 PM.
But nothing prevents you from entering three entries in your cron table.


30 5,8,11 * * * my-command
这意味着在第30分钟的5、8和11小时.

问题是如果您想5: 00 ,8: 30 和11: 00 ...
CRON不处理选项,但是如果您每隔0和30分钟运行comand,则可以从文件中进行处理,因此您可以处理这两个开始点.

拆分任务更容易,并且更难以根据时间创建规则.
30 5,8,11 * * * my-command
This means hours 5, 8 and 11 at minute 30.

A problem would be if you wanna 5:00, 8:30 and 11:00...
CRON does not handle options but you can do it from your file if you run the comand each minute 0 and 30, so you can handle these 2 points of start.

It''s so easier to split tasks and harder to create rules based on time.


这篇关于运行3次cron作业(例如8:30 AM,5:30 PM和11:30 PM)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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