首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

crontab施用心得

2013-04-12 
crontab使用心得1.查看crontab说明[fwang5@szotautotest03 ~]$ more /etc/crontabSHELL/bin/bashPATH/sb

crontab使用心得

1.查看crontab说明

[fwang5@szotautotest03 ~]$ more /etc/crontabSHELL=/bin/bashPATH=/sbin:/bin:/usr/sbin:/usr/binMAILTO=rootHOME=/# 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

?2.查询crontab服务命令和当前状态

[fwang5@szotautotest03 ~]$ sudo /sbin/service crondUsage: /etc/init.d/crond {start|stop|status|restart|condrestart|try-restart|reload|force-reload}[fwang5@szotautotest03 ~]$ sudo /sbin/service crond statuscrond (pid  20109) is running...

?

3.查看crontab配置

[fwang5@szotautotest03 ~]$ sudo crontab -u fwang5 -l5 8 * * * /home/MSDOMAIN1/fwang5/work/weblogin-monitor/loginstart.sh &> /dev/null0 9 * * * /home/MSDOMAIN1/fwang5/work/stash-user-monitor/start.sh &> /dev/null

?

4.编辑crontab配置(自动进入VI编辑模式)

[fwang5@szotautotest03 ~]$ sudo crontab -u fwang5 -e5 8 * * * /home/MSDOMAIN1/fwang5/work/weblogin-monitor/loginstart.sh &> /dev/null0 9 * * * /home/MSDOMAIN1/fwang5/work/stash-user-monitor/start.sh &> /dev/null~~"/tmp/crontab.uDsLmb" 2L, 161C

?

5.删除crontab配置

[fwang5@szotautotest03 ~]$ sudo crontab -u fwang5 -r

?

6.查看crontab日志

[fwang5@szotautotest03 ~]$ sudo tail -f /var/log/cronApr  8 14:02:50 szotautotest03 crontab[24296]: (root) LIST (fwang5)Apr  8 14:02:56 szotautotest03 crontab[24298]: (root) BEGIN EDIT (fwang5)Apr  8 14:03:57 szotautotest03 crontab[24298]: (root) REPLACE (fwang5)Apr  8 14:03:57 szotautotest03 crontab[24298]: (root) END EDIT (fwang5)Apr  8 14:04:01 szotautotest03 crond[20109]: (fwang5) RELOAD (/var/spool/cron/fwang5)Apr  8 14:10:20 szotautotest03 crontab[24314]: (root) LIST (fwang5)Apr  8 14:29:15 szotautotest03 crontab[24323]: (root) LIST (fwang5)Apr  8 14:35:53 szotautotest03 crontab[24385]: (root) LIST (fwang5)Apr  8 14:36:22 szotautotest03 crontab[24387]: (root) BEGIN EDIT (fwang5)Apr  8 14:37:49 szotautotest03 crontab[24387]: (root) END EDIT (fwang5)

?

热点排行