2

CiviMail scheduled e-mails are not being triggered automatically through CRON. Using the same user with the same permissions, I get the following in the log when triggered through the Scheduled Jobs user interface:

Parameters parsed (and passed to API method): 
a:1:{s:7:"version";i:3;}

Full message: 
Finished execution of Send Scheduled Mailings with result: Success (a:1: 
{s:9:"processed";i:1;})

But when the same is triggered on CRON using CURL

Parameters parsed (and passed to API method): 
a:1:{s:7:"version";i:3;}

Full message: 
Finished execution of Send Scheduled Mailings with result: Success (a:1: 
{s:9:"processed";i:0;}

I'm not getting any errors when I call the CRON page from the browser. On the CiviCRM status page it shows that CRON is running. In conclusion, the scheduled task processes address only from the user interface and not from CRON.

I am using the latest CiviCRM build (5.3.1).

  • sounds like it might not be picking up the user to run under.. What CMS are you using - for Drupal & Wordpress there are better command line utilitites for running sched jobs (drush & wp-cli) – user4278 Jul 21 '18 at 22:48
3

Had the same problem, on Ubuntu change the system time zone with "sudo dpkg-reconfigure tzdata". Restart the mysql service with "sudo service mysql restart".

Can confirm that this gets the cron running and processing the mailing.

2

I figured out that it was due to a time zone setting mismatch between MariaDB and PHP. Taking inspiration in this forum post https://forum.civicrm.org/index.php%3Ftopic=26132.0.html, I observed that the time zone settings on the server were different than in the database. My workaround was as follows:

  1. On Drupal, I disabled the option to allow users to select their own time zones and made sure that America/New York was selected
  2. On my server (I have CentOS 7 running) I selected the time zone

    sudo timedatectl set-timezone America/New_York
    
  3. Afterwards I logged in to MySQL and noticed that the time zone was still incorrect

    mysql> select now();
    
  4. I restarted the MariaDB service on my server

    sudo systemctl restart mariadb
    
  5. I logged in to MySQL again and confirmed that the hour matched my time zone settings
  6. I ran again the command from SSH using both curl and cv (see here for details on how to set that up: https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/)
  7. I finally confirmed that the scheduled e-mails were triggered as intended

I hope this solution can help others solve this otherwise tricky workaround. My intuition was based on the fact that the CRON job itself was not failing, and my user had all the correct Drupal permissions (I verified by logging in and checking to see if all contacts were visible).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.