天天看點

crontab定時任務報錯

報錯内容:

Crontab -e 或crontab -l 檢視定時任務時出現如下報錯

no crontab for root - using an empty one

crontab: installing new crontab

解決:

1.在/etc下添加一個配置檔案cat-conf(名字無要求) 内容是你要做的定時任務0 12 */2 * * /usr/bin/cat /dev/null > /var/log/messages

2.執行此操作: crontab -u root /etc/cat-conf

3. crontab -l 可以了

(補充:删除定時任務:将/var/spool/cron/root中的内容删除即可)