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
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