gentoo crontab:为什么这个简单的crontab无法正常工作? [英] gentoo crontab: why this simple crontab is not working?

查看:109
本文介绍了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/.

这篇关于gentoo crontab:为什么这个简单的crontab无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆