内容简介:Crontab命令格式与范例
crontab file [-u user]-用指定的文件替代目前的 crontab
crontab-[-u user]-用标准输入替代目前的 crontab
crontab-1[user]-列出用户目前的 crontab
crontab-e[user]-编辑用户目前的 crontab
crontab-d[user]-删除用户目前的 crontab
crontab-c dir- 指定 crontab 的目录
$crontab -l 列出用户目前的 crontab
crontab 文件的基本格式 :
* * * * * command
分 时 日 月 周 命令
第 1 列表示分钟 1~59 每分钟用*或者 */1 表示
第 2 列表示小时 1~23(0 表示 0 点)
第 3 列表示日期 1~31
第 4 列表示月份 1~12
第 5 列标识号星期 0~6(0 表示星期天)
第 6 列要运行的命令
一些范例:
30 21 * * * /usr/local/etc/rc.d/lighttpd restart
上面的例子表示每晚的 21:30 重启 apache。
45 4 1,10,22 * * /usr/local/etc/rc.d/lighttpd restart
上面的例子表示每月 1、10、22 日的 4 : 45 重启 apache。
10 1 * * 6,0 /usr/local/etc/rc.d/lighttpd restart
上面的例子表示每周六、周日的 1 : 10 重启 apache。
0,30 18-23 * * * /usr/local/etc/rc.d/lighttpd restart
上面的例子表示在每天 18 : 00 至 23 : 00 之间每隔 30 分钟重启 apache。
0 23 * * 6 /usr/local/etc/rc.d/lighttpd restart
上面的例子表示每星期六的 11 : 00 pm 重启 apache。
* */1 * * * /usr/local/etc/rc.d/lighttpd restart
每一小时重启 apache
* 23-7/1 * * * /usr/local/etc/rc.d/lighttpd restart
晚上 11 点到早上 7 点之间,每隔一小时重启 apache
0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart
每月的 4 号与每周一到周三的 11 点重启 apache
0 4 1 jan * /usr/local/etc/rc.d/lighttpd restart
一月一号的 4 点重启 apache
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Crontab命令格式与范例
- ls 命令的 20 个实用范例
- C++ 编程规则 使用范例
- 大小端序分析以及 go 范例
- PHP设计模式范例 — DesignPatternsPHP(1)创建型设计模式
- Oracle数据库文件:listener.ora和tnsnames.ora范例
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JavaScript & jQuery
David Sawyer McFarland / O Reilly / 2011-10-28 / USD 39.99
You don't need programming experience to add interactive and visual effects to your web pages with JavaScript. This Missing Manual shows you how the jQuery library makes JavaScript programming fun, ea......一起来看看 《JavaScript & jQuery》 这本书的介绍吧!