加入收藏 | 设为首页 | 会员中心 | 我要投稿 荆州站长网 (https://www.0716zz.cn/)- 图像处理、语音技术、媒体智能、运维、低代码!
当前位置: 首页 > 运营中心 > 网站设计 > 教程 > 正文

Linux -bashcrontab:commandnotfound错误修复办法

发布时间:2022-06-16 14:09:28 所属栏目:教程 来源:互联网
导读:如果你的Linux -bash: crontab: command not found错误,一个是没有安装,另一个是因为了,下面一起来看解决方法. 操作步骤: 1.确认crontab是否安装: 执行 crontab 命令如果报 command not found,就表明没有安装. 2.安装 crontab,执行 yum install -y vixie-c
  如果你的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,还是一个很人性化的设置.

(编辑:荆州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读