Crontab不起作用

时间:2016-10-14 02:18:04

标签: ubuntu cron

我有各种使用cronjobs的Ubuntu服务器。但是,在其中一个上,我无法让crontab运行。 通常,当我想重新启动cron守护程序时,我会执行此操作并获得以下结果:

~$ sudo service cron restart
cron stop/waiting
cron start/running, process 26310

但是,在这个Ubuntu版本上,我得到以下内容:

root@f5ba9eb61881:~# sudo service cron restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cron restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop cron ; start cron. The restart(8) utility is also available.

当我希望它运行时,我无法让cron守护进程记录信息。我跟着这个帖子:https://askubuntu.com/questions/56683/where-is-the-cron-crontab-log/121560 我已经按照用户12345的建议但无济于事。

我在crontab中安排了一个作业(使用sudo crontab -e),计划每分钟运行一次:

    # m h  dom mon dow   command
   * * * * *       /home/ace_request_blast.sh >> /home/myscript.log 2>&1

但是,我在syslog中看到的只是我对crontab的编辑,这意味着作业没有运行。

root@e43d3c67124f:/var/www/journa# sudo tail -f /var/log/syslog
Oct 14 01:15:47 e43d3c67124f crontab[2050]: (root) REPLACE (root)
Oct 14 01:15:47 e43d3c67124f crontab[2050]: (root) END EDIT (root)
Oct 14 01:15:57 e43d3c67124f crontab[2062]: (root) BEGIN EDIT (root)
Oct 14 01:16:09 e43d3c67124f crontab[2062]: (root) REPLACE (root)
Oct 14 01:16:09 e43d3c67124f crontab[2062]: (root) END EDIT (root)
Oct 14 01:18:43 e43d3c67124f crontab[2148]: (root) BEGIN EDIT (root)
Oct 14 01:18:58 e43d3c67124f crontab[2148]: (root) REPLACE (root)
Oct 14 01:18:58 e43d3c67124f crontab[2148]: (root) END EDIT (root)
Oct 14 01:27:25 e43d3c67124f crontab[2224]: (root) BEGIN EDIT (root)
Oct 14 01:27:35 e43d3c67124f crontab[2224]: (root) END EDIT (root)

有关如何运行cronjob的任何想法?我认为它可能是某种权限问题。

1 个答案:

答案 0 :(得分:0)

请尝试这个

  

systemctl start SERVICE

从这里采取https://askubuntu.com/questions/19320/how-to-enable-or-disable-services

  

<强> SYSTEMD   从Ubuntu 15.04开始,Upstart将被弃用   Systemd。使用Systemd管理服务,我们可以执行以下操作:

希望它有用。

相关问题