We recently ran into a strange situation where cron jobs configured within cPanel didn’t work. They wouldn’t send email. They wouldn’t run scripts. They didn’t do anything. Yet all of the typical troubleshooting turned up nothing: Permissions were correct. The scripts ran fine from CLI. Shell access was enabled for the account. Output wasn’t being directed to
/dev/null. Everything was configured right. etc.
It turns out that cron settings are stored (on CentOS6, at least) under
/var/spool/cron/$USER. In this file, you can find the email address that should get cron output, the various cron lines, and most interestingly, a setting for the shell to use for that users cron jobs.
In this case, it was set for
Which meant that scripts that worked just fine from CLI, didn’t work at all from cron.
Correct settings, depending on your setup, seem to be:
After a quick
service crond restart to be safe, everything was instantly back to normal. I’m not even sure restarting crond was needed.