无法启动 cron 服务

无法启动 cron 服务

几天前,我添加了一个 cronjob crontab -e,它应该每 6 小时运行一次,但我注意到 cron job 不起作用。当我手动执行脚本时,它可以工作,它应该将一些数据写入文件,这样我就可以知道它是否有效。为了找出问题所在,我执行了这个命令:service cron status我得到了这个:

Redirecting to /bin/systemctl status  cron.service
● cron.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

当我执行service cron start时我得到了这个:

Redirecting to /bin/systemctl start  cron.service
Failed to start cron.service: Unit cron.service failed to load: No such file or directory.

有人可以提示我该怎么做吗,我不是这方面的专家。

谢谢

编辑:输出来自service crond status

Redirecting to /bin/systemctl status  crond.service
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Pet 2016-05-13 13:46:20 EDT; 1 weeks 3 days ago
 Main PID: 26127 (crond)
   CGroup: /system.slice/crond.service
           └─26127 /usr/sbin/crond -n

Maj 13 13:46:20 host systemd[1]: Started Command Scheduler.
Maj 13 13:46:20 host systemd[1]: Starting Command Scheduler...
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 88% if used.)
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (running with inotify support)
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Maj 17 13:49:01 host crond[26127]: (root) RELOAD (/var/spool/cron/root)
Maj 17 13:52:01 host crond[26127]: (mailman) RELOAD (/var/spool/cron/mailman)
Maj 24 10:06:01 host crond[26127]: (root) RELOAD (/var/spool/cron/root)

编辑2:

输出自crontab -l

0 6 * * * /usr/local/cpanel/scripts/exim_tidydb > /dev/null 2>&1
30 5 * * * /usr/local/cpanel/scripts/optimize_eximstats > /dev/null 2>&1
2,58 * * * * /usr/local/bandmin/bandmin
0 0 * * * /usr/local/bandmin/ipaddrmap
46 13 * * * /usr/local/cpanel/scripts/upcp --cron
40 2 * * * /usr/local/cpanel/scripts/cpbackup
23 21 * * * /usr/local/cpanel/bin/backup
35 * * * * /usr/bin/test -x /usr/local/cpanel/bin/tail-check && /usr/local/cpanel/bin/tail-check
45 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_mailman_cache && /usr/local/cpanel/scripts/update_mailman_cache
30 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
30 */2 * * * /usr/local/cpanel/bin/mysqluserstore >/dev/null 2>&1
15 */2 * * * /usr/local/cpanel/bin/dbindex >/dev/null 2>&1
15 */6 * * * /usr/local/cpanel/scripts/autorepair recoverymgmt >/dev/null 2>&1
*/5 * * * * /usr/local/cpanel/scripts/dcpumon-wrapper >/dev/null 2>&1
37 4 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify
13,28,43,58 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1
19 4 * * * /usr/local/cpanel/3rdparty/bin/freshclam --quiet --no-warnings
0 */6 * * * /usr/bin/php /home/legacy/EssentricTools/src/index.php migrate:sync -c prod

我的命令是最后一个

答案1

由于显示的信息不多,我猜测应该运行的脚本的权限存在问题,您配置了错误的作业或指定了错误的路径。

如果您不想测试所有这些,而更喜欢简单快捷的方式,请阅读<user executing cron>的本地邮件,您就会看到错误。

相关内容