Linux -bashcrontab:commandnotfound错误修复办法

  如果你的Linux -bash: crontab: command not found错误,一个是没有安装,另一个是因为了,下面一起来看解决方法.
 
  操作步骤:
 
  1.确认crontab是否安装:
 
  执行 crontab 命令如果报 command not found,就表明没有安装.
 
  2.安装 crontab,执行 yum install -y vixie-cron:
 
  3.确认是否安装成功:执行 crontab -l
 
  4.看是否设置了开机自动启动:
 
  chkconfig --list crond
 
  5.启动crontab
 
  service crond start
 
  如果安装了还不能支持可能是权限问题,脚本写的是否正确,shell脚本是否拥有执行权限,一切正常还不能执行的话,就用以下方法,使root用户的crontab生效.
 
  crontab -u root /var/spool/cron/root
 
  重启crontab服务:service crond restart
 
  可能出现的错误:
 
  "cronfile1":2: premature EOF errors in crontab file, can"t install.
 
  在crontab文件末尾增加一个空行就可解决此问题.
 
  "/tmp/crontab.NINM91":1: bad day-of-week errors in crontab file,can"t install --phpfensi.com
 
  根据提示,是第一行的周写错了.
 
  crontab -e保存时,crond会检测时间格式,如果时间格式不正确就会报错errors in crontab file,can’t install,还是一个很人性化的设置.

dawei

【声明】:石嘴山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。