Linux 定时任务 Crontab 介绍

实例

# 每日23:59执行 /usr/local/script/log.sh 脚本

59 23 * * * /usr/local/script/log.sh

# 每周一凌晨4点整执行 /usr/local/script/log.sh 脚本

0 4 * * 1 /usr/local/script/log.sh

# 每小时的第10分钟执行 /usr/local/script/log.sh 脚本

10  *  *  *  * /usr/local/script/log.sh

# 每10分钟执行一次 /usr/local/script/log.sh 脚本

*/10  *  *  *  * /usr/local/script/log.sh

# 每个月的第一天和第15天执行 /usr/local/script/log.sh 脚本

*  *  1,15  *  * /usr/local/script/log.sh

每个 * 的注解

注解
第一个 一小时中第几分钟 0-59
第二个 一天中第几个小时 0-23
第三个 一个月中第几天 1-31
第四个 一年第几个月 1-12
第五个 一周中星期几 0-6

注意:

  • 星期几和第几天不能同时出现
  • 不能设定「2020 年的 7 月 10 号凌晨 3 点 15 分 30 秒」这样的一个时间去执行命令,因为没有年和秒的概念

查看任务列表

crontab -l

编辑任务

crontab -e

清空任务

crontab -r

知识共享许可协议
本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可。
随喜
支付宝随喜
微信随喜

khjk

......

"We also issued a blanket order that asked anyone who had been in the library, on 4/11 between 11 and 3 to self-quarantine, notify health services and establish that they were immune before they exposed themselves to the public," said Barbara Ferrer, Los Angeles County's public health director. Nike Outlet store http://www.nikefactoryoutletstoreonline.us/

http://www.pandora-com.us/ Pandora Jewelry Official Site NFL Jerseys http://www.nfl-jerseys.us.org/

Cialis Overdose Cialis Composizione <a href=http://cthosts.net>viagra vs cialis</a> Levitra Acquisto In Contrassegno

Kamagra Faq <a href=http://cialviag.com>canadian pharmacy cialis</a> Viagra A Casa

Effets Secondaires Cialis 10 No Pain Tooth Infection And Amoxicillin Propecia Pnt <a href=http://banzell.net>viagra online pharmacy</a> Zithromax For Babies

Chloramphenicol <a href=http://genericvia.com>viagra</a>; Lawrence Walter Pharmacy Canada