Crontab 命令不起作用

Crontab command not working

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

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

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

没有 cron.allowcron.deny 文件,cron 守护程序正在运行:

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

知道哪里出了问题吗?

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

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

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

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