码迷,mamicode.com
首页 > 系统相关 > 详细

Linux_5day------------使用crontab调度命令

时间:2015-09-07 16:53:59      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:crontab

调度命令的使用

  1. 普通命令执行

[root@xxzx /]# date >> /home/mydate.txt
#---------------------------查看效果---------------------------------
[root@xxzx /]# cat /home/mydate.txt
Mon Aug 31 07:04:56 EDT 2015

2. 调度命令的执行

[root@xxzx /]# crontab -e
no crontab for root - using an empty one
* * * * * date >> /home/mydate.txt
#分 时 日 月 星期
#* * * * * 代表每分钟
#0 2 * * * 代表每日2:00
#0 2 3 * * 代表每月3号的2:00
#0 2 3 4 * 代表4月3日的2:00
#0 2 * * 0 代表每周一的2:00
#---------------------------查看效果---------------------------------
[root@xxzx /]# cat /home/mydate.txt
Mon Aug 31 07:04:56 EDT 2015
Mon Aug 31 07:07:01 EDT 2015
Mon Aug 31 07:08:01 EDT 2015
Mon Aug 31 07:09:01 EDT 2015

3.通过调用执行文件来进行调度命令

[root@xxzx /]# vi /home/mydate.sh
date >> /home/mydate2.txt
[root@xxzx /]# chmod 744 /home/mydate.sh
[root@xxzx /]# crontab -e
* * * * * /home/mydate.sh
#---------------------------查看效果---------------------------------
[root@xxzx /]# cat /home/mydate2.txt
Mon Aug 31 07:14:01 EDT 2015


Linux_5day------------使用crontab调度命令

标签:crontab

原文地址:http://keefe.blog.51cto.com/9548710/1692326

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