Centos Crontab Bad Command

Steve Peterson picture Steve Peterson · May 13, 2015 · Viewed 7.5k times · Source

I have a pretty simple db back-up script that runs perfectly from shell.

php /home/db_backup/db_backup.php

When I attempt to add a Crontab, I get the vague 'Bad Command errors in crontab, can't install."

I've tried w/ php and full path to php.

which php

returns /usr/bin/php

* 1 * * * php /home/db_backup/db_backup.php

* 1 * * * /usr/bin/php /home/db_backup/db_backup.php

Both return the same error.

Centos 6.6. logged in as root. Editing crontab thusly

crontab -e

Spent too many hours trying to get this working. What am I missing?

Answer

Iris G. picture Iris G. · May 13, 2015

I bet your problem is when editing the crontab file not with the commands itself.

Be sure to let a blank line at the end of file.

I mean the cursor must be in an empty line after the last entry.