forked from judasn/Linux-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YouMeek
committed
Dec 9, 2015
1 parent
2c6d2b8
commit b712881
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<h1 id="crontab0">Crontab 介绍</h1> | ||
|
||
------ | ||
|
||
* [Crontab 介绍](#crontab0) | ||
* [Crontab 安装](#crontab1) | ||
* [Crontab 服务器配置文件常用参数](#crontab2) | ||
* [Crontab 资料](#crontab3) | ||
|
||
------ | ||
|
||
<h2 id="crontab1">Crontab 安装</h2> | ||
|
||
- 查看是否已安装: | ||
- CentOS:`rpm -qa | grep cron` | ||
- Ubuntu:`dpkg -l | grep cron` | ||
|
||
- 安装(一般系统是集成的): | ||
- CentOS 6:`sudo yum install -y vixie-cron crontabs` | ||
- Ubuntu:`sudo apt-get install -y cron` | ||
|
||
<h2 id="crontab2">Crontab 服务器配置文件常用参数</h2> | ||
|
||
- 配置文件介绍(记得先备份):`sudo vim /etc/crontab` | ||
- 该配置格式解释: | ||
-  | ||
- 常用例子介绍: | ||
- 30 21 * * * service httpd restart #每晚的 21:30 重启 apache | ||
- 45 4 1,10,22 * * service httpd restart #每月的 1、10、22 日的 4:45 重启 apache | ||
- 45 4 1-10 * * service httpd restart #每月的 1 到 10 日的 4:45 重启 apache | ||
- */2 * * * * service httpd restart #每隔两分钟重启 apache | ||
- 1-59/2 * * * * service httpd restart #每隔两分钟重启 apache(这个比较特殊:1-59/2 这个表示过掉0分,从 1 分开始算,每隔两分执行,所以 1 分执行了,3 分执行了,5 分执行了....都是奇数进行执行。默认的 */2 都是偶数执行。) | ||
- 0 23-7/2 * * * service httpd restart #晚上 11 点到早上 7 点之间,每隔 2 个小时重启 apache | ||
- 0-59/30 18-23 * * * service httpd restart #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法一) | ||
- 0,30 18-23 * * * service httpd restart #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法二) | ||
|
||
<h2 id="crontab3">Crontab 资料</h2> | ||
|
||
- <http://www.imooc.com/video/4498> | ||
- <http://www.centoscn.com/image-text/config/2015/0901/6096.html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.