【问题标题】:Crontab command not workingcrontab 命令不起作用
【发布时间】:2015-04-13 08:44:51
【问题描述】:

我知道这个问题已经被问过很多次了,我也做了很多研究,但我仍然无法运行这个极其简单的 cron:

$ crontab -l
* * * * * /bin/date

理想情况下,这应该每分钟打印一次日期。

没有cron.allowcron.deny 文件,cron 守护进程正在工作:

ps -e | grep cron
1119 ?        00:00:00 cron
17646 ?        00:00:00 cron

知道可能出了什么问题吗?

【问题讨论】:

    标签: cron crontab


    【解决方案1】:

    Cron 进程在它们自己的单独子进程中运行,因此您在 shell 中看不到 cron 作业的输出。

    相反,您必须捕获 cron 命令的输出并保存它们。因此,将您的 cronjob 设置为:

    * * * * * /bin/date >> /home/user/date.log
    

    现在,如果您跟踪此日志文件,您将开始看到结果。

    【讨论】:

      猜你喜欢
      • 2017-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-12
      • 2021-09-30
      • 2019-10-12
      • 2020-01-02
      • 2019-01-22
      相关资源
      最近更新 更多