Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have setup the following crontab -

sudo crontab -e

01 21 * * * /usr/local/bin/ -e

This should run at 21.01 every night but it never runs. here is the error log

cron[2339]: (root) RELOAD (crontabs/root)
CRON[31600]: (root) CMD (/usr/local/bin/ -e)
CRON[31599]: (CRON) error (grandchild #31600 failed with exit    status 2)
CRON[31599]: (CRON) info (No MTA installed, discarding output)

I have set the permission to 777 and the owner is root. I can run the file by entering the above file path.

share|improve this question
Post the code in /usr/local/bin/ My guess is you are not using full paths. – Bart De Vos May 20 '11 at 12:08

1 Answer 1

up vote 3 down vote accepted

Your script seems to be exiting with status 2, which cron interprets as an error.

Does it exit with status 0 if run by hand?

/usr/local/bin/ -e
echo $?

Check you're not assuming things about the environment that aren't true when run by cron. In particular use absolute paths when invoking other scripts or binaries.

Try replacing the cron job with sh -x /usr/local/bin/ -e - it should then display line-by-line execution info (I haven't ever tried it with cron though).

share|improve this answer
THANKS! looks like it is an error in my script, strange it runs fine in a cronjob on other servers. – Alex May 20 '11 at 13:32

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.