gentoo crontab:为什么这个简单的crontab无法正常工作?
我使用GENTOO发行版.
I use a GENTOO distribution.
crontab -e
crontab -e
35 12 * * * root php5 /home/www/cron.php
当我手动运行时:
php5 php5 /home/www/cron.php
这有效(它给我发送了一封电子邮件)
This works (it sends me an email)
然后我检查日期 在12:35 pm ...都没事!
Then I check date at 12:35pm... nbothing !
我也尝试过:
*/1 * * * * root php5 /home/www/cron.php
所以它每分钟都会给我发送一封电子邮件,没什么!
So it sends me an email every minute and NOTHING !
我还尝试了php5的完整路径
I also tried with full path of php5
*/1 * * * * root /usr/local/bin/php5 /home/www/cron.php
看起来像crontab不起作用:知道为什么吗? 我该怎么办?
Looks like crontab does not work: any idea why ? What do I do wrong ?
致谢
在crontab -e
中使用的语法不允许您指定用户名.它总是像你自己一样运行.
The syntax you use in crontab -e
does not allow you to specify the user name; it always runs as yourself.
因此,root
是语法错误(它导致Cron尝试运行命令root
,该命令可能不存在);取出并重试.
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.
如果您需要以root身份运行作业,请将文件(现在为用户名 )放在/etc/cron.d/
中.
If you need the job to run as root, put the file (now with the user name) in /etc/cron.d/
.