Centos 默認沒有開啟crond
systemctl start crond.service
添加自啟動猛铅?
echo "systemctl start crond.service" >> /etc/rc.local
關(guān)于crontab命令的詳細參數(shù)可以查看man
主要有以下這些
-e 以編輯器方式編輯該用戶的計時表(默認vi打開/var/spool/cron/username)
-l 列出該用戶的計時器設(shè)置吧寺。
-r 刪除該用戶的計時器設(shè)置。
-u<用戶名稱> 指定要設(shè)定計時器的用戶名稱霎箍。
crontab -u scu -l //查看scu用戶的計時器設(shè)置
# 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
另外還有“/”的用法,例如我需要每4天執(zhí)行一次任務(wù)瓜贾,可以這么寫
0 0 */4 * * commad