Wake-up Call for Site Administrators - Consolidated Cron Hits the Pavement in 4.1

2012-01-22 17:37
Written by

Thanks to a successful Make-it-Happen campaign the 4.1 release comes with a much improved and super flexible approach for running Civi's critical back-ground processing tasks. These tasks include keeping membership statuses up to date and sending renewal reminders, sending scheduled CiviMail mailings, sending pledge payment reminders, and more. I've spent the past 10 days testing and documenting the new "consolidated cron" functionality, and the good news is that I think it fulfills the promise of providing a convenient and friendly way to administer and run all the required tasks for a site.


The "bad" news is that these improvements are NOT backward compatible. The set of PHP scripts which were previously used to run these tasks have all been deprecated (and moved to a 'deprecated' directory). This means that all CiviCRM-related cron jobs will stop working as soon as any site is upgraded to 4.1. (Yes, a loud warning will appear on the screen at the end of the upgrade process.)


Although you'll still have the option of configuring separate cron jobs to trigger each of these tasks - many of you will want to take advantage of the ability to use the new administrative interface to enable the jobs you need, and configure run frequency for each job. Then you can configure a single "master" cron task to trigger ALL enabled CiviCRM jobs whose next run is due. For example, you may want to run the CiviMail mailing scheduler every time your master cron task runs (which might be once a minute). However, you only want the Address geocoder job to run once a day. You can enable both jobs, and set the run frequency for the mailing scheduler to "Every time cron job is run", while setting the frequency for the Address geocoded to "Daily".


You can also use the Scheduled Jobs interface to run specific jobs on an ad hoc basis. For example, you probably only need to run the "Set Renewal Reminder Dates" after making changes to the renewal reminder settings for a membership type. Although you can do this from the command-line, it's probably easier to just navigate to Administer > System Settings > Scheduled Jobs and click "Execute Now" for that job.


So … in the interest of helping us make sure things are working properly in YOUR environment, and helping you prepare for the upgrade I strongly encourage you to do a test upgrade on a copy of your site. You can then walk through the process of evaluating the new options for running scheduled jobs and configuring your cron task(s). If you hit any issues during testing, please post a detailed report to the 4.1 testing forum board.


Take some time to review the detailed list of the available Scheduled Jobs and the syntax for running all jobs OR a specific job. The documentation covers both the PHP CLI method, as well as the URL method (invoked using 'wget' or 'curl').


SAFETY TIP - Several of the scheduled jobs which you may be using in production involve sending email to your constituents. Obviously you want to ensure that this does NOT happen from you test site. You can ensure that NO emails are actually sent from any CiviCRM site by adding the following line to your civicrm.settings.php file:


define( 'CIVICRM_MAIL_LOG', 1 );


Kudos to Eileen McNaughton for pushing and prodding this much needed improvement along, to everyone who contributed to the MIH, and to Eileen, Jamie McClelland, Tim Otten, Xavier Dutoit and Michal Mach for the hard work and creative thinking that went into the design and implementation.