CentOS7 crontab 不执行,报错 /bin/sh: root: command not found
2014-10-18 19:43
423 查看
使用CentOS7 执行定时脚本,结果提示报错:
问题在于文件 /var/spool/cron/root ,中无需再写root。
修改之后的脚本:
文件 /etc/crontab 全部内容:
查看crontab 状态:
[root@localhost logs]# service crond status
Redirecting to /bin/systemctl status crond.service
crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled)
Active: active (running) since Sat 2014-10-18 19:13:38 HKT; 31min ago
Main PID: 17467 (crond)
CGroup: /system.slice/crond.service
└─17467 /usr/sbin/crond -n
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 56% if used.)
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (running with inotify support)
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Oct 18 19:24:01 localhost.localdomain crond[17467]: (*system*) RELOAD (/etc/crontab)
Oct 18 19:27:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:32:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:33:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:34:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:38:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:40:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
by default7#zbphp.com
/bin/sh: root: command not found
问题在于文件 /var/spool/cron/root ,中无需再写root。
修改之后的脚本:
[root@localhost cron]# crontab -l */10 * * * * perl /home/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.zbphp.com >> /sbin/null 2>&1
文件 /etc/crontab 全部内容:
[root@localhost ~]# nano /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
查看crontab 状态:
[root@localhost logs]# service crond status
Redirecting to /bin/systemctl status crond.service
crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled)
Active: active (running) since Sat 2014-10-18 19:13:38 HKT; 31min ago
Main PID: 17467 (crond)
CGroup: /system.slice/crond.service
└─17467 /usr/sbin/crond -n
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 56% if used.)
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (running with inotify support)
Oct 18 19:13:38 localhost.localdomain crond[17467]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Oct 18 19:24:01 localhost.localdomain crond[17467]: (*system*) RELOAD (/etc/crontab)
Oct 18 19:27:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:32:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:33:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:34:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:38:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
Oct 18 19:40:01 localhost.localdomain crond[17467]: (root) RELOAD (/var/spool/cron/root)
by default7#zbphp.com
相关文章推荐
- /bin/sh: root: command not found
- 9fe2 Jenkins中shell-script执行报错sh: line 2: npm: command not found
- 阿里云 esc 云服务器无缘无故的一次/usr/bin 目录丢失导致整个服务无法启动 # ./shutdown.sh ./shutdown.sh: line 41: dirname:command not found cannot find /catalina.sh the find /catalina.sh The file is absent or does not have execute
- bug宝典PYTHON篇 /bin/sh: mvn: command not found
- Cronjob 定时执行 pentaho job(解决spoon.sh command line not found 问题)
- Centos7 Minni 安装 执行ifconfig命令出现 -bash ifconfig command not found 的解决方法
- bash: crontab: command not found
- CentOs命令接口中出现“command not found”出现的几个原因
- centos python sh recode command not find的解决办法
- linux2.6.30.4内核移植(6)——移植应用程序hello world常见的错误:-bin/sh ./hello not found
- CentOS中无法使用setup命令 -bash:setup: command not found
- /bin/sh: autoreconf: command not found (centos 6.5 install qemu from source code)
- 怎么解决/bin/sh: arm-linux-gcc: not found make
- shell /bin/bash^M: bad interpreter错误和-bash: rz: command not found
- centos 遇到 sudo gem command not found
- bash:crontab:command not found
- mac终端运行mysql -uroot -p时出现-bash: mysql: command not found
- -bin/sh ./hello not found,程序运行不了,库文件不对应
- 我在linux主机用arm-linux-gcc编译后,复制到开发板根目录运行,出现/bin/sh: ./hello not found
- cygwin下执行makefile报/bin/sh: svn: command not found