1、crontab定制后台定时备份任务时报出“bad minute”及“errors in crontab file, can't install”错误,“Do you want to retry the same edit? Enter Y or N”
根本原因crontab文件中时间格式定义不正确导致的,需要严格按照下面格式书写。
0 0 * * * /data/date/date.sh
分 时 日 月 周(0-6)【用户】 绝对路径脚本
#####
当用户是root时,需省略,否者会出现如下报错
/bin/sh: root: command not found
2、crontab定时任务不执行,并且没有收到错误信息邮件
A:查看日志/var/log/cron显示如下
CROND[15777]: (root) MAIL (mailed 33 bytes of output but got status 0x0043#012)
B:使用sendmail 命令
endmail: warning: valid_hostname: numeric hostname: 7
sendmail: fatal: file /etc/postfix/main.cf: parameter mydomain: bad parameter value: 7
原因:sendmail没有安装
3、重新执行脚本
/bin/sh: root: command not found