Search code examples
linuxcroncentos6.5

Centos Crontab Bad Command


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?


Solution

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