4

I'm trying to setup Mass SMS and Mailing and seem to be running into some problems. I can send mail and SMS directly to an individual but the scheduled SMS and mail does not work. I know this has to do with Cron being configured incorrectly but I'm not sure where to look. I have CiviCRM 4.6.3 installed on Drupal 7.37. I also have installed the Drupal Cron module from here.

When the job is manually executed I get a success message. Where are some other places I should be checking?

  • How often are your sites cron running? Could it just be that you did not wait long enough? – Flying Jun 26 '15 at 16:37
  • To test the SMS and Mailing, I've used the "Send Immediately" selection. – Sean Jun 26 '15 at 16:39
  • I would suspect (I don't know this...) that "Send immediately" is not depended on the cron running. So again, how often does your sites cron run? – Flying Jun 26 '15 at 16:42
  • It's my understanding that the job is "Scheduled" immediately which is executed by cron. Right now I have the Send Scheduled SMS job run frequency set to 'Every time cron job is run'. – Sean Jun 26 '15 at 16:47
  • And how often is cron job run on your site? This would be a Drupal setting, not a CiviCRM setting. – Flying Jun 26 '15 at 16:49
1

Is there a reason you're using the "CiviCRM Cron" module? That's adding an needless level of complexity to your site. Since you are able to get the job to work by manually executing the job, I suspect that there's a problem in the way you've configured the "CiviCRM Cron" module.

Disable the module, and set up cron the normal way. You'll want CiviCRM's cron job to run way more often (every 5-15 minutes) than Drupal's cron should (every 1-3 hours). Doing a real cron job will also bypass problems that may crop up with the "CiviCRM Cron" Drupal module.

Here's how. Visit the Managing Scheduled Jobs page on the CiviCRM wiki for reference.

If you have Drush installed, just use the "Drush Method" from that page. Test it out on the command line, and if that works, set the cron job to be something like

*/6 * * * * /usr/bin/drush -u 1 -r /path/to/drupal -l www.example.org civicrm-api job.execute auth=0 -y

That runs every 6 minutes, which makes a nice even 10 runs per hour.

If you don't have Drush, use the following steps (the "PHP CLI method"):

  1. Create a user account that has "Access CiviCRM" and "Administer CiviCRM" privileges. (You could theoretically use your own, but you will be putting the password in plain text in the cron job, so it's safer to create a separate one.)
  2. Put together what you need in this format:

    php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute

    You can drop the "-s site" if you only have one site running. Replace the word "user" with your new user's Drupal username, and the word "password" with its password.

  3. If you have SSH access and are comfortable with the command line, you'll have a leg up. Try running that command. Check your Scheduled Jobs page to see that it ran (making sure that your mailing sender job is enabled and set to run on every cron run--not hourly or daily).

  4. Assuming that worked, set up the cron job

    */6 * * * * php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute

    Again, I like six minutes to make the arithmetic easy by having 10 cron runs per hour.

This should dodge any problems with the "CiviCRM Cron" module, and it should allow you to run your mailings and SMS messages much more promptly.

For reference, "send immediately" does depend upon cron to run. It actually isn't literally immediate--it just schedules it for the current time, and cron takes it from there.

| improve this answer | |
  • Thank you very much Andrew. I worked through your comment and it worked! – Sean Jun 30 '15 at 16:47

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.