gentoo crontab: why this simple crontab is not working?

◇◆丶佛笑我妖孽 提交于 2019-12-04 07:04:45

问题


I use a GENTOO distribution.

crontab -e

35 12  * * *    root    php5 /home/www/cron.php

When I run manually:

php5 php5 /home/www/cron.php

This works (it sends me an email)

Then I check date at 12:35pm... nbothing !

I also tried with:

*/1 * * * *     root    php5 /home/www/cron.php

So it sends me an email every minute and NOTHING !

I also tried with full path of php5

*/1 * * * *     root    /usr/local/bin/php5 /home/www/cron.php

Looks like crontab does not work: any idea why ? What do I do wrong ?

regards


回答1:


The syntax you use in crontab -e does not allow you to specify the user name; it always runs as yourself.

So, the root is a syntax error (it causes Cron to try to run the command root, which probably does not exist); take it out and try again.

If you need the job to run as root, put the file (now with the user name) in /etc/cron.d/.



来源:https://stackoverflow.com/questions/19952590/gentoo-crontab-why-this-simple-crontab-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!