五、计划任务:cron工具crontab

来源:百度知道 编辑:UC知道 时间:2024/06/23 17:44:43
五、计划任务:cron工具crontab
cron配置文件有两组:/etc/crontab和临时/tmp
此文件的格式可以分为七段。每个计划任务一定要占一行,不可以一行有多个计划任务,每段之间用空格隔开。
怎样用,请高手速回!谢了!!!

<developer:/home/developer/UPGW/pub/bin>crontab -l
*/2 * * * * /home/developer/UPGW/pub/bin/angel
00 02 * * * /home/developer/UPGW/pub/bin/genhkfile.sh
00 04 * * * /home/developer/UPGW/pub/bin/logsave.sh
00 03 * * * /home/developer/UPGW/pub/bin/databackup.sh
30 09 * * * /home/developer/UPGW/pub/bin/loadfujian.sh
00 05 * * * /home/developer/UPGW/pub/bin/movetohistory.sh
20 08 * * * /home/developer/UPGW/pub/bin/putbilltozb.sh
<developer:/home/developer/UPGW/pub/bin>

上面是我机子上面的实例,一般来说要编译,输入crontab -e 然后按我上面写的,输入任务执行的时间以及需要运行的脚本,程序等,好了之后像vi一样的,要输入(:q)来保存。
运用下面的命令来开启和停止等来加载crontab。

/sbin/service crond start 启动
/sbin/service crond stop 停止
/sbin/service crond restart 重启服务
/sbin/service crond reload 重新加载配置