3

I have a multisite WordPress setup with CiviCRM 4.7.23 and I am unable to create a successful cron job. I tried CLI with all parameters (including -s) and with no parameters but each time I get no output and CiviCRM says cron was not executed.

I tried the URL method

https://mysite.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=XXX&pass=XXX&key=XXX

and same thing.

I tried, just for fun, the cli file via a browser and I got

cli.php can only be run from command line.

which is at least correct. :)

The site in question is hosted on CiviHosting and the setup there is known to support both CLI and URL cron jobs for single-site setups.

2

I manage one WordPress multisite instance, so I looked how cron is configured.

We use wp-cli with the CiviCRM extension to trigger cron.

Cron jobs look like:

11,26,41,56 * * * * /full/path/to/wp-cli --user=civicrmcron --url=https://sitenumber7.org/ --require=/full/path/to/wp-cli/civicrm.php --path=/path/to/wordpress/webroot civicrm api --timezone=America/New_York job.execute auth=0 > /dev/null
12,27,42,57 * * * * /full/path/to/wp-cli --user=civicrmcron --url=https://sitenumber8.org/ --require=/full/path/to/wp-cli/civicrm.php --path=/path/to/wordpress/webroot civicrm api --timezone=America/Los_Angeles job.execute auth=0 > /dev/null

Note that if your multisite instances are in a subdirectory, rather than a different domain, you can set the URL accordingly and it still works.

Also note: Some WordPress plugins can interfere with cron! That's not multi-site specific, but you can exclude plugins from loading with wp-cli either by specifying on the command line or creating a config file.

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.