Aller directement à la fin des métadonnées
Aller au début des métadonnées
CiviCRM Documentation

CiviCRM includes a number of PHP scripts which process data and handle batch tasks "in the background". These scripts are run from the server command line, often as automatically scheduled "cron" jobs. Except where otherwise noted, all of these scripts are located in the bin directory below your main CiviCRM install directory.

NOTE: Some scripts require additional editing before use (e.g. to configure the correct FROM email address for membership renewal reminders). These scripts are delivered with a .txt extension and must be renamed before use.

Component

Script Filename

Description

CiviMail

civimail.cronjob.php

Sends queued CiviMail mailings

CiviMember

UpdateMembershipRecord.php

Updates membership statuses and optionally sends renewal reminders

CiviPledge

UpdatePledgeRecord.php

Updates pledge payment and pledge statuses and optionally sends payment reminders

Core

UpdateAddress.php

Geocodes addresses in bulk

Core and CiviCase

Email2Activity.php

Inserts activity for a contact or a case (v2.2+) by retrieving inbound emails from a mail directory

(all}

CRM/Utils/REST.php

Handles REST API calls

You are required to pass authentication information at runtime to prevent these scripts from being invoked by an unauthorized agent. As of versions 2.1.2 OR 2.0.7 , a Site Key is required in addition to a valid username and password. Include all three parameters when invoking these scripts:

  • name - Valid username for an authorized Drupal or Joomla user.
  • pass - Associated password for that user
  • key - The value of the CiviCRM site key from your settings file (see below)

EXAMPLE: Using wget to run the UpdateMembershipRecord.php script in a Drupal installation, the command line would look like this:

Make sure there that there are no reserved or unsafe URL characters in your username or password. These include:

and spaces.

Configuring your Site Key

For CiviCRM versions 2.0.7+ and 2.1.2+ - you must manually generate a site key, and then add it to your CiviCRM settings file.

  • First generate the key. We recommend using a 16-32 bit alphanumeric/punctuation key value. You can ...
    • create a random 16-32 character key from your keyboard OR
    • use an external service like: http://www.thebitmill.com/tools/password.html OR
    • use the following shell command to generate a key

      Make sure there that there are no reserved or unsafe URL characters in your site key. These include:

      and spaces.

  • Open your settings file - civicrm.settings.php - in your favorite editor and either add or edit the CIVICRM_SITE_KEY value.
    [Default location for civicrm.settings.php in Joomla is: site/administrator/components/com_civicrm]

Depending on which version of CiviCRM you've installed, you may have this setting in your file already with a value of null, or you may need to add the line. In either case, replace null with the value of your key.

EXAMPLE: If my generated site key value is: 3cx4aNkpQwxmM1hTMV~!B09iO6
... then my settings file should look like this:

  • Finally, make sure that you include the key=<sitekey> parameter whenever your run any of these scripts.
Étiquette
  • Aucun
  1. Nov 24, 2008

    So your cron command will be something like:

    wget 'http://example.org/path/to/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<password>&key=<sitekey>'

  2. Dec 28, 2008

    makepasswd --randomseed=0 --char=32 will generate something like '1TUJnEFBGTJzKEiUaGqI5c9K2ydtL4Es'

     makepasswd is a debian package that has been ported to most platforms. (it is written in perl and very portable).

     I highly recommend it for passwords that humans do not have to remember.

  3. Jan 28, 2009

    Joe K. dit :

    We can run the update scripts manually and they work but cron jobs continually log this 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.


Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.