码迷,mamicode.com
首页 > 其他好文 > 详细

crontab

时间:2015-12-04 22:51:14      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

crontab

系统调度进程。可以使用它在每天的非高峰负荷时间段运行作业,或在一周或一月中的不同时段运行。

at

使用它在一个特定的时间运行一些特殊的作业,或在晚一些的非负荷高峰时
间段或高峰负荷时间段运行。

 

查看当前的任务  crontab -l

创建一个任务

1. crontab -e

2. vim cronscript   and add content eg: 0-59 * * * *  echo `date` >> /home/xxx/cron.output

关于: 0-59 * * * * 格式可参照 /etc/crontab

cat /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
一共五个* ,在实际的例子中* 可以理解为“每”的意思

0-59 * * * * 可以理解为每一个月的每一天,每一天中的每一个小时,每一小时的每一分钟执行。。。。操作

 

删除crontab任务

crontab -r

 

crontab

标签:

原文地址:http://www.cnblogs.com/cdwodm/p/5020673.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!