3

Greetings and salutations. I know some of you must be growing impatient with all of these cron questions from the noobs. I am at a loss. I have consulted all of the documentation links posted in the cron question threads and tried every example given. I have even changed hosting providers and installed a fresh copy of Drupal 7 and CiviCRM separately (the bundle caused all kinds of errors that I didn't know how to fix). I have everything working now except cron. Still. I have scoured every resource I can find trying to understand cron and c/p'ed every example of cron settings relevant to CiviCRM and Drupal. I still cannot get cron to fire automatically and the error on the status page will not go away. I can click the button and run it manually, so it doesn't seem to be a permissions issue. I really don't know what else to do at this point. My current cron setting is

22 */2 * * * wget -O - -q -t 1 http://mydomain.com/cron.php?cron_key=mykey > /dev/null

Can anyone please explain to me WHY this is wrong so that hopefully I can get this running? Please and thank you.

Solution: Single quote (') before http and after the end of site key in addition the wget etc.

This is how it should look:

*/6 * * * * wget -O - -q -t 1 'http://mydomain.com/sites/all/modules/civicrm/bin/cron.php?name=username&pass=password&key=site-key'

Thank you everyone for the help and to Hock for providing the info about single quotes around the http attribute.

7

The cron job you have there looks like a Drupal cron job. You should look at the scheduled jobs wiki page for full details, but in the case of a Drupal site using wget (since that is the direction you're seeming to go in), try:

*/6 * * * * wget -O - -q -t 1 http://mydomain.com/sites/all/modules/civicrm/bin/cron.php?name=username&pass=password&key=site-key

You'll find the "site-key" in the civicrm.settings.php file, and the "username" and "password" correspond to a Drupal user with Administer CiviCRM permission.

You'll see that I have it going every six minutes rather than every 2 hours: you'll want to set CiviCRM cron to run multiple times per hour; you can set specific scheduled jobs to run less frequently from the management page in CiviCRM.

| improve this answer | |
  • Thank you, Andrew. I did look at that Wiki and followed the examples with no luck. I will try your suggestion and hopefully get it working. Thank you. – Rod W May 8 '16 at 0:03
  • I set it exactly as you indicated. I verified the user info and password as well. I don't know if I'm using the right key. It took some time to find a file called civicrm.settings.php and the site key listed didn't seem as complex as what I had in there before (and now I don't remember where the file is that I found the previous key). The previous key had many mixed case letters, numbers, and even and underscore. The key I found in this file had a couple of lower case letters and a bunch of numbers and that's it. – Rod W May 8 '16 at 1:24
  • I let this go overnight and it seems it is still not working correctly. At least according the civiCRM System Status Report. I really don't know where to go from here. I have ordered "Using CiviCRM" ( smile.amazon.com/Using-CiviCRM-Joseph-Murray/dp/1849512264 ) to see if it will give me some insight. I also just received "Drupal 7 Explained" by Stephen Burge to see if that will help, as well. If you know of something else I could try, I would be grateful. TIA. - R – Rod W May 8 '16 at 14:35
  • The key thing is that the URL should work when you visit it in a browser. If the browser doesn't work, the wget won't either. You might also try resetting the password to not include special characters. – Andrew Hunt May 8 '16 at 18:32
  • 1
    So I am the biggest moron ever. My domain ends in .org and not .com and I missed that when I kept copy and pasting. Working now. D'oh!! – Rod W May 8 '16 at 18:40
0

I have had the same issues but thanks to above I sorted it out so thanks for that. My confusion was over using CRON in Cpanel and how that interfaced with CRON in Drupal and Scheduled jobs in Civicrm So the link available in Drupal does work but does not affect the Civicrm Scheduled Jobs. Note the different cron.php locations.

viz: From Drupal to run externally (this works for Drupal but not Civicrm) http://my.org/drupal/cron.php?cron_key=YufnNO9tj4npU4BN6zLJOVsu_pKO7eapX2siu5-yMOU

Viz: From Cron in CPanel (this works for Civicrm but not Drupal - which is correct ) wget -O - -q -t 1 'http://my.org/drupal/sites/all/modules/civicrm/bin/cron.php?name=username&pass=password&key=site-key' Note the single quotes. I hope this helps someone.

| improve this answer | |
  • Are the single quotes required for this to work? That wasn't clear in your note. I'm not clear if you are saying to note them to remove them when we add it to our cron config or if we need to have them in our cron config. – Rod W Dec 5 '16 at 18:20
  • I definitely used the single quotes in the script for CRON from CPANEL, I have copied and pasted, changed the domain, user, password and the key. wget -O - -q -t 1 'mydomain.com.au/drupal/sites/all/modules/civicrm/bin/…' – Hock Dec 6 '16 at 22:16

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.