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 »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • CiviMail Cron Job - Invalid Key (sometimes)
Pages: [1]

Author Topic: CiviMail Cron Job - Invalid Key (sometimes)  (Read 1701 times)

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 11:23:39 am
Hi.

I've been struggling to get the CiviMail cron to run properly. Here's the cron command I'm using...

wget -O - -q -t 1 http://www.atlanticcoasttheatre.co.uk/administrator/components/com_civicrm/civicrm/bin/civimail.cronjob.php?name=***&pass=***&key=***

If I use the http address directly in a browser the script runs perfectly, but I can't get it running properly as a cron job from my server. The above command spits out 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

Any ideas?

Cheers,

Ian.

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 11:33:57 am
Might have to do with wget, have you tried to run it with curl

like curl -s <url to civimail.cronjob.php?name=foo&pass=bar&key=key>

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 12:05:32 pm
Hey there!

Gave it a try, but got the same 'Invalid Key' error.

At least I can get it to run stuff from a browser if I need to!

Thanks for the advice though.

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 12:09:40 pm
if you really want


maybe do a file_get_contents in a php script and run that script?

Or you can also do a curl inside php as well

By the way, just to make sure, you did set the site key in the civicrm.settings.php, correct?


Cheers

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 12:40:41 pm
Well it's not ideal, but I'm not great at the scripting stuff - I'll give that php script idea a go (might take a couple of attempts!).

I've double checked the two settings files and the key is the same in both. I assume it wouldn't work from a browser if it were incorrect though.

I'll see what I can do with the php script.

Cheers again!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 13, 2010, 11:38:37 pm
Hi,

If you have php-cli on the server, try to run it directly instead of going through curl/wget (check the book for more details)

Is your key containing weird chars (eg. &`/) ? Might be that the shell doesn't like them

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 14, 2010, 02:39:48 am
Hey!

Thanks for the ideas.

Already tried curl with the same 'invalid key' result, and I can't find a php cli in my cpanel to give it a go.

I might try making a clean install on a test site incase all the monkeying around I've been doing to get the thing running has broken something.

If in doubt, start from scratch - especially if you haven't got a clue what you're doing!

Cheers!!!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 14, 2010, 03:58:10 am
Hi,

I would as well strongly suggest you to spend the time to read this chapter of our book:
http://en.flossmanuals.net/CiviCRM/SystemConfiguration

Setting up a mailing system that works well is tricky, hopefully the book is going to avoid you most of the problems

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 14, 2010, 04:01:09 am
Cheers Xavier - I'm determined to get it working.

The more I use CiviCrm the more impressed with it's capabilities I am - I remember when I first started looking at it a year ago it terrified me!

Ian.

Ian G.

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 0
    • Atlantic Coast Theatre
  • CiviCRM version: 4.4+
  • CMS version: Joomla 3+
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 14, 2010, 08:49:18 am
Well I don't want to speak too soon, but it looks like the setup page from here:http://en.flossmanuals.net/CiviCRM/SystemConfiguration has sorted me out!

I'm using the following:

wget -O - -q -t 1  --post-data='name=mailprocess&pass=seol-lzprm42amv-
  psyc&key=yoursiteinstallkey' http://www.example.org/sites/all/modules/civicrm
  /bin/civimail.cronjob.php

and just got a test mailing arrive in my inbox. COuld have sworn I tried this combination of commands, but I guess not!

Thanks everyone for your advice!

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: CiviMail Cron Job - Invalid Key (sometimes)
October 14, 2010, 11:57:36 am
It's interesting though that you are doing a http post to the cron script, (which I guess it would work). But theoretically if you can get it to work in the browser you should've been able to do the wget or curl without using --post-data parameter.

In any case this actually happened to me too, I overcame it with clearing civicrm cache and changing my site key.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • CiviMail Cron Job - Invalid Key (sometimes)

This forum was archived on 2017-11-26.