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) »
  • Civimail Cron
Pages: [1]

Author Topic: Civimail Cron  (Read 1376 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Civimail Cron
February 17, 2011, 04:46:02 pm
To the author of http://en.flossmanuals.net/CiviCRM/SystemConfiguration (who has a French accent & starts with X) - do you really put all this in the Cron? I see it works but I kept looking for the bit in FLOSS manual that said to create this as a script & call that from Cron - but I didn't find it

The following is complete cron configuration to handle CiviCRM's mail requirements:

Code: [Select]
# This must be set to the directory where civicrm is installed.
CIVI_ROOT=/var/www/civicrm
USER=www-data
MAILTO="you@example.org"
# Location of the PHP Command Line Interface binary. nice -19 forces to run at a
lower priority than the web server
PHP=nice -n19 /usr/bin/php

#line to be modified according to the informations below
PARAMS= -sdefault -umailprocess -pseol-lzprm42amv-psyc
#cronjob send
# m h  dom mon dow   command
*/5 * * * * cd $CIVI_ROOT;$PHP  bin/civimail.cronjob.php $PARAMS
*/15 * * * * cd $CIVI_ROOT;$PHP bin/EmailProcessor.php $PARAMS
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Civimail Cron
February 17, 2011, 05:02:06 pm
Quote from: Eileen on February 17, 2011, 04:46:02 pm
do you really put all this in the Cron?

Personally I prefer to capture all required settings into a self standing Bash script which may be run either interactively of via cron.

The only variables I define in crontab are PATH (so that cron runs with the same PATH as when I am logged in), and COLUMNS to assist Drush.
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Civimail Cron
February 17, 2011, 05:25:26 pm
Would you be able to post your script & what you put in the cron as a sample?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Civimail Cron
February 17, 2011, 07:05:48 pm
 ;D hee hee hee... not using CiviMAIL yet as our organization had too complication of requirements to replace what we have been using with CiviMAIL.

So last I worked on CiviMAIL was when we were yet on D5 / Civi 2.0, and with that version of code I yet have: civicrm-civimail.cronjob.php.sh

Code: [Select]
#!/bin/bash

PARAMS='-sdefault -ucivicrm-cron -p*****************'

cd /srv/www/sites/domain.org/www/sites/all/modules/civicrm
/usr/bin/nice -n19 /usr/bin/php bin/civimail.cronjob.php $PARAMS

Oh, and that I simply run via crontab:

Code: [Select]
05,20,35,50 * * * * /srv/www/sites/domain.org/bin/civicrm-civimail.cronjob.php.sh
« Last Edit: February 17, 2011, 07:09:24 pm by mdlueck »
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

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
February 20, 2011, 04:13:41 am
Oh la la my dear, I am not sure who you are referring to, but yeap, running it like that in some config.

Otherwise, put the file under /etc/cron.d, same stuff, but you can set the user for each line:

*/15 * * * * www-data cd $CIVI_ROOT;$PHP bin/EmailProcessor.php  -sxx -pxxx -uxxx

Doesn't work for you ?

Quote from: Eileen on February 17, 2011, 04:46:02 pm
To the author of http://en.flossmanuals.net/CiviCRM/SystemConfiguration (who has a French accent & starts with X) - do you really put all this in the Cron? I see it works but I kept looking for the bit in FLOSS manual that said to create this as a script & call that from Cron - but I didn't find it

The following is complete cron configuration to handle CiviCRM's mail requirements:

Code: [Select]
# This must be set to the directory where civicrm is installed.
CIVI_ROOT=/var/www/civicrm
USER=www-data
MAILTO="you@example.org"
# Location of the PHP Command Line Interface binary. nice -19 forces to run at a
lower priority than the web server
PHP=nice -n19 /usr/bin/php

#line to be modified according to the informations below
PARAMS= -sdefault -umailprocess -pseol-lzprm42amv-psyc
#cronjob send
# m h  dom mon dow   command
*/5 * * * * cd $CIVI_ROOT;$PHP  bin/civimail.cronjob.php $PARAMS
*/15 * * * * cd $CIVI_ROOT;$PHP bin/EmailProcessor.php $PARAMS
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Civimail Cron
February 20, 2011, 01:12:13 pm
Hi, your method as described in the manual does work but I was assuming that the the 'recommended method' would be more like that Posted by: mdlueck
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

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
February 20, 2011, 02:13:19 pm
why?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Civimail Cron
February 20, 2011, 02:39:39 pm
Hmm - it just seems better form to keep what's in the cron as simple as possible & to have the 'stuff' outside the cron.

It works fine - it's just that I didn't think you really meant us to put all that stuff direct into the cron script the first couple of times I read it so I didn't try it
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Civimail Cron
February 20, 2011, 07:22:51 pm
Quote from: xavier on February 20, 2011, 02:13:19 pm
why?

Personally I get nervous that Cron job B might not like XYZ parm specified in the cronfile which Cron job A requires... thus I prefer to define variables in a shell script and not in the cronfile.

Also, allows the script to be run free standing / outside of the cron environment.
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

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
February 20, 2011, 10:33:47 pm
Hi,

I see your points.

I do have either all the cronjobs in www-data, or all the crons of of civi into /etc/cron.d/civicrm, so the global variables issue isn't such a pb. If you want to isolate completely, create one /etc/cron.d per site.

Not too much reason, just that I keep all the config about the param in one place instead of spreading it around several scripts (you have one for civimember, 2 for civimail, 1 for drupal...)

Something that would be nice is adding a param on how often (max) each of these can be run (eg the bounce runs no more than 15 min), one with the user that should be running it (and get rid of that "password it clear in the bash" that makes me nervous)
and hook_cron that, so you got one and only one cron called.

*/5 * * * * www-data cd $CIVI_ROOT_33;$PHP  bin/civimail.cronjob.php -sdefault -umailprocess -pseol-lzprm42amv-psyc
*/15 * * * * www-data cd $CIVI_ROOT_33;$PHP bin/EmailProcessor.php -sdefault -umailprocess -pseol-lzprm42amv-psyc
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Civimail Cron

This forum was archived on 2017-11-26.