从零开始的Linux运维屌丝之路,资源免费分享平台   运维人员首选:简单、易用、高效、安全、稳定、社区活跃的开源软件

crond命令-定时任务

发布:蔺要红04-13分类: cmd


crond命令
 

NAME
       crond - daemon to execute scheduled commands

 
[root@moban ~]# vim /etc/logrotate.conf  #系统自带的一些轮训日志,了解即可
[root@moban logrotate.d]# pwd
/etc/logrotate.d

crontab -l   list     查看
crontab -e   edit  编辑
vim /var/spool/cron/root  #定时任务文件位置

基本格式 : 
*  *  *  *  *  command 
分  时 日  月  周    命令 

00 00 * * *  		#每天0晨
*/5 * * * *  		#每5分钟执行1次
30 21 * * * 		#表示每晚的21:30
0 */1 * * * 		#每一小时
45 4 1,10,22 *  * 	#表示每月1、10、22日的4:45
0 23 * * 6 			#表示每星期六的11 : 00 
30 */6 * * *  		#没隔6小时的30分 
#
-连续的   	00 17-19 * * *
,列表		00 17,19 * * *
 

 定时任务日志:
[root@moban logrotate.d]# cat /var/log/cron
定时任务: 一定要注意环境变量
                      需要在脚本里定义环境变量



图解:

温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,如有侵权我会在24小时之内删除!
<<fdisk命令 | ln>>

欢迎使用手机扫描访问本站