Why would my cron job fail half the time?

I’m using Cron Jobs on through cpanel on a site hosted by Site Ground on a WordPress 4.3 site running CiviCRM 4.6.1. The intention is to run the job every 30 minutes (which is the most allowed by our ISP). I’ve tried these various calls as recommended by http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs (site, username, and password omitted):

0,30 * * * * php public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s *site* -u *username* -p *password* -e Job -a execute 

*/30 * * * * php public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s *site* -u *username* -p *password* -e Job -a execute 

or as two calls:

Read More
30 * * * * php public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s *site* -u *username* -p *password* -e Job -a execute

0 * * * * php public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s *site* -u *username* -p *password* -e Job -a execute

For some reason no matter how I write the cron jobs the cron always fails on the hour but not half. On the hour I get the following error in my cron e-mail response:

DB Error: no database selected
Died during callApi

but it’s running the same code each time so shouldn’t I get this every time the cron runs? On the half hour everything executes as it should and the scheduled e-mails send properly. Is there something I’m missing? Also, every time I run the command from the terminal it executes properly and sends the scheduled e-mails. It’s only the cron jobs on the hour that are giving me the issue. Thanks for your help.

Related posts

1 comment

  1. Thanks samuelsov. The issue was with executing all of the CiviCRM scheduled jobs. The mail send wasn’t the issues, it was one of the other processes. I change the cron to run the specific scheduled mail job and and the issue went away. Now I can troubleshoot the other jobs if I want to include them. Thanks!

Comments are closed.