每天下午6点Cron [英] Cron every day at 6 pm

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

问题描述

我试图弄清楚如何将cron设置为每天下午6点运行。这是正确的吗?

I'm trying to figure out how to set cron to run every day at 6 p.m. Is this correct?

我要问的原因是这是用于生产服务器的,所以我需要确定。

The reason I'm asking is this is for a production server, so I need to be sure.

* 18 * * *


推荐答案

0 18 * * * command to be executed
^ you need to set the minute, too. Else it would be running every minute on the 18th hour

如何设置cronjob一般:

How to setup a cronjob in general:

 # * * * * *  command to execute
 # │ │ │ │ │
 # │ │ │ │ │
 # │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
 # │ │ │ └────────── month (1 - 12)
 # │ │ └─────────────── day of month (1 - 31)
 # │ └──────────────────── hour (0 - 23)
 # └───────────────────────── min (0 - 59)

星号(*)是什么意思

星号表示cron表达式匹配该字段的所有值。例如,在第四个字段(月)中使用星号表示每个月。

The asterisk indicates that the cron expression matches for all values of the field. E.g., using an asterisk in the 4th field (month) indicates every month.

侧注

cronjobs中的其他特殊字符

Other special characters in cronjobs

斜杠(/)

斜线表示范围的增量。例如,第一字段(分钟)中的3-59 / 15表示每小时的第三分钟,此后每15分钟一次。形式 * / ...等效于形式 first-last / ...,即在该字段的最大可能范围内递增。

Slashes describe increments of ranges. For example 3-59/15 in the 1st field (minutes) indicate the third minute of the hour and every 15 minutes thereafter. The form "*/..." is equivalent to the form "first-last/...", that is, an increment over the largest possible range of the field.

逗号(,)

逗号用于分隔列表中的项目。例如,在第五个字段(星期几)中使用 MON,WED,FRI表示星期一,星期三和星期五。

Commas are used to separate items of a list. For example, using "MON,WED,FRI" in the 5th field (day of week) means Mondays, Wednesdays and Fridays.

连字符(-)

连字符定义范围。例如,2000-2010表示公元2000年到2010年之间的每一年(包括首尾两天)。

Hyphens define ranges. For example, 2000-2010 indicates every year between 2000 and 2010 AD, inclusive.

百分比(%)

除非使用反斜杠()进行转义,否则命令中的百分号(%)将更改为换行符,并且将第一个%之后的所有数据作为标准输入发送给命令。

Percent-signs (%) in the command, unless escaped with backslash (), are changed into newline characters, and all data after the first % are sent to the command as standard input.

(来源: https://en.wikipedia .org / wiki / Cron

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

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