-1

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

yarek
  • 11,278
  • 30
  • 120
  • 219
  • Please try specifying the php5 executable full path (ie /use/bin/php5) and tell us how it goes. – Marco Poli Nov 13 '13 at 11:34
  • I JUST DID !!! and still bad : */1 * * * * root /usr/local/bin/php5 /home/www/cron.php and of course when luching : /usr/local/bin/php5 /home/www/cron.php IT WORKS ! – yarek Nov 13 '13 at 11:36
  • If you get an email, the cron job works. What's in the email? Presumably an error message? Please include it in the question. – tripleee Nov 13 '13 at 11:39

1 Answers1

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

tripleee
  • 175,061
  • 34
  • 275
  • 318