Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script

php /home/v/file.php
sh /root/x/

when I execute the file as root from command line it works.

sh /home/v/ 

when I set it to crontab -e (is the root cron), is not working

 * * * * * sh /home/v/

What do I do wrong? Thanks

share|improve this question
up vote 5 down vote accepted

The enviroment for cron to run into is very very limited, try to always use full path for binaries.

/usr/bin/php /home/v/file.php
/bin/sh /root/x/

This considers that your php binary is in /usr/bin/php, please change that appropiately if it's not the case

Also try to add in top of your cron the MAILTO line in order to get a direct mail with any error that can happen during the execution
* * * * * sh /home/v/
share|improve this answer

It is probable the php binary isn't in the default cron PATH. You should put the full path to your php binary in your script

/usr/bin/php /home/v/file.php

You should also provide a path for sh

/bin/sh /root/x/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.