CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • cron job failing with site key error
Pages: [1]

Author Topic: cron job failing with site key error  (Read 975 times)

dschafer

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 3
    • Backoffice Thinking
  • CiviCRM version: 3.2.3 - 4.4.4
  • CMS version: Drupal 6.x, 7.x, Wordpress
  • MySQL version: 5.1.x - 5.5.x
  • PHP version: 5.2.x - 5.4.x
cron job failing with site key error
February 03, 2010, 09:53:30 am
Hi,
I set up the cron job for email send yesterday. The job is currently set to stop at 9pm and resume running at 7am.

Everything was fine yesterday. Today when the job resumed at 7am I started geting the following error.

ERROR: You need to send a valid key to execute this file. More info at:http://wiki.civicrm.org/confluence/display/CRMDOC/Command-line+Script+Configuration

According to the cron log the job is being run with the same site key as yesterday.

Site key from cron job: &key=XVaaaELCJ8UTTxLD
Settings.php
define( 'CIVICRM_SITE_KEY', 'XVaaaELCJ8UTTxLD' );

Am I missing something?

Thanks

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: cron job failing with site key error
February 03, 2010, 11:52:20 am
Checking where that exact error message comes from - CRM/Utils/System.php line 433 - it looks like the key= parameter is not being found in the _REQUEST object (i.e. it's not saying that the key is wrong, it's saying that no key is being passed in). So you might recheck the cron params, and also might try running the job directly from a browser location bar to confirm that it works with the correct set or URL (query string) params.
Protect your investment in CiviCRM by  becoming a Member!

dschafer

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 3
    • Backoffice Thinking
  • CiviCRM version: 3.2.3 - 4.4.4
  • CMS version: Drupal 6.x, 7.x, Wordpress
  • MySQL version: 5.1.x - 5.5.x
  • PHP version: 5.2.x - 5.4.x
Re: cron job failing with site key error
February 04, 2010, 12:11:59 pm
Thanks for the hint.

I finally found it. Seem there might be an conflict in some of the documentation refering to using wget.

First thing I did was confirm that the url worked.

I originally set up the cron job using the post model (http://wiki.civicrm.org/confluence/display/CRMDOC/Command-line+Script+Configuration)

wget -O - -q -t 1  --post-data="name=myuser&pass=mypass&key=mykey" http://mysite/sites/all/modules/civicrm/bin/civimail.cronjob.php

But couldn't get it to work. So I switch to the get model by removing the post data and setting the params

wget -O - -q -t 1  http://mysite/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=myuser&pass=mypass&key=mykey

It seems that the documentation in the POST example should have included single quotes around the url.  When I checked the server log the request get ended at the second &.

Adding single quotes around the url solved the problem.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: cron job failing with site key error
February 04, 2010, 04:02:52 pm
I updated the example. Going forward please feel free to improve / correct the doc when you see problems :-)
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • cron job failing with site key error

This forum was archived on 2017-11-26.