cron tab在linux中是常用的设置定时任务的命令。而一般出现以下错误的话就都是crontab命令使用错误导致的。
"/tmp/crontab.OpQB2O" 1L, 38C written
crontab: installing new crontab
"/tmp/crontab.OpQB2O":1: bad hour
errors in crontab file, can't install.
Do you want to retry the same edit? y
或者这样的
"/tmp/crontab.OpQB2O" 1L, 43C written
crontab: installing new crontab
"/tmp/crontab.OpQB2O":1: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? y
不同之处在于第三行是bad hour 还是 bad minute 又或者是其他
"/tmp/crontab.LC1Bwd":1: bad day-of-week
原因都是crontab的用法出错。
那么正确的用法如下:在输入crontab -e 命令回车后进入vi编辑页面
接下来的编辑应该是
***** 执行的任务
注意! (1) 执行的任务之前有5个*
(2) 5个*与执行的任务之间也要有空格**
如果定时任务正确的话,输出的结果应该是 installing new crontab
"/tmp/crontab.LC1Bwd" 2L, 46C written
crontab: installing new crontab