-----------------------------------------------------------------
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
30 00 * * * root bash /root/code/Crawler/Crawler/SpiderTask.sh
38 14 16 * * root bash /root/code/UserLabel/UserLabelStart.sh
-----------------------------------------------------------------
如上所示為/etc/crontab文件中內(nèi)容悄雅,公司服務(wù)器為centos挥下。根據(jù)上圖可知,前5個*為定時器執(zhí)行時間配置房揭,后面緊跟著執(zhí)行用戶名袜硫,后緊跟著要執(zhí)行的命令氯葬。
配置完成后,可使用以下命令進行crond服務(wù)動作:
service crond start 啟動服務(wù)
service crond stop 停止服務(wù)
service crond restart 重啟服務(wù)
service crond reload 重新加載配置
執(zhí)行命令時注意權(quán)限問題M裣荨V愠啤!