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 Daemon
Pages: [1]

Author Topic: Cron Daemon  (Read 3913 times)

crayon

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.2
  • MySQL version: 5.0.91
  • PHP version: 5.2.17
Cron Daemon
June 07, 2008, 08:32:01 am
I am getting the following email every minute.  How and why is it generated and how can I make it stop?

Subject:   Cron <earthsav@sm4> http://donations.earthsave.org/path/to/civicrm/bin/civimail.cronjob.php?name=admin&pass=caryn
From:   "Cron Daemon" <root@sm4.vegsource.com>
Date:   Sat, May 31, 2008 7:58 am
To:   earthsav@sm4.vegsource.com
Priority:   Normal
Options:   View Full Header | View Printable Version  | Download this as a file
 

/bin/sh:
http://donations.earthsave.org/path/to/civicrm/bin/civimail.cronjob.php?name=admin:
No such file or directory

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Cron Daemon
June 08, 2008, 03:27:18 am
You have a scripted job set up to handle mail bounces from CiviCRM. It looks like someone has followed the instructions from the CiviMail setup docs incompletely; the command is supposed to be

Code: [Select]
wget http://donations.earthsave.org/path/to/civicrm/bin/civimail.cronjob.php?name=admin&pass=xxxx

A couple of changes need to be made:

1. Add "wget" to the start of the command
2. Fix the path to CiviCRM to be the actual path to CiviCRM on your server

I think what you want in the cron job is,

Code: [Select]
wget -q --spider http://donations.earthsave.org/civicrm/bin/civimail.cronjob.php?name=admin&pass=xxxx

If you don't have wget, you probably have curl, which wants these args

Code: [Select]
curl -o /dev/null -s http://donations.earthsave.org/civicrm/bin/civimail.cronjob.php?name=admin&pass=xxxx

The -q and --spider arguments will ensure that wget doesn't return anything, so you don't get a mail every five minutes.

You'll need to ask your server admin (or whoever set up CiviMail for you) to do this.

(You should also change your admin password ASAP.)
@xurizaemon ● www.fuzion.co.nz

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: Cron Daemon
August 07, 2008, 12:54:21 pm
This might solve a lot of work for me - we get an email every 15 minutes as we have our Cron Job set.  We also get a 0 size file for each run in the root directory.

Thanks!

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Cron Daemon
August 07, 2008, 08:35:29 pm
@DenverDave - can you post the wget or curl command you are using which leaves a file behind? I suspect it's wget, as curl doesn't save a file by default. (Don't include your password in the posted command though!)

You can prevent a file being saved to disk using either of the following arguments for wget:
Code: [Select]
-O /dev/null
Code: [Select]
--spider
To prevent an email being generated each time the cron job runs, you can use the following argument for wget:
Code: [Select]
-q
Putting them together, we use one of the following formats (some systems have wget by default, others curl, both do the same job fine):
Code: [Select]
wget --spider -q 'http://my.host.name/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=USERNAME&pass=PASSWORD'
Code: [Select]
curl -o /dev/null -s 'http://my.host.name/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=USERNAME&pass=PASSWORD'

@chartglass - If your cron job is still running 60 times an hour (ie, every minute), you should know this can cause issues if server load means that a job takes more than 60 seconds to complete. This situation can result in many jobs being run concurrently, with compounding effects, and overload the server quicker than you might anticipate.

The cron syntax to specify how often it runs uses the first column to specify the minute of the hour it should run at. Instead of a * here, using a */5 or */15 will result in the job running once every five / fifteen minutes, which is far less likely to cause problems.

I expect that CiviCRM prevents concurrent issues internally anyway, using some kind of lock to prevent multiple concurrent CiviMail jobs. Still, it might help for you to know how to prevent cron jobs misbehaving in case you have other automated tasks.
@xurizaemon ● www.fuzion.co.nz

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: Cron Daemon
August 07, 2008, 10:59:40 pm
I haven't tried the suggested changes yet - here are my current settings:

wget 'http://<mydomain>/drupal/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<my uid>&pass=<my password>'

I had no idea what settings would be optimal either - we are currently running 50 emails every 10 minutes, with our largest run being a little over 2,300 which means it takes almost 8 hours to do our run of the entire name list, which is fine.  What settings are others using?

What makes our situation somewhat unique is that we have a half dozen or so people from various Health Care For All Colorado chapters submitting bulk emails.  I started out with 20 every 10 minutes, but then some people figured out that they could segment the run and submit multiple jobs simultaneously which didn't seem like a good idea so I upped it to 50 every 10.   Sometimes we learn about a single-payer universal health care event and have to get the word out in a hurry.
« Last Edit: August 07, 2008, 11:18:41 pm by Denver Dave »

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Cron Daemon
August 08, 2008, 12:26:39 am
Batch limit set to 200, running the CiviMail cron job at five minute intervals
Code: [Select]
*/5  *  *  *  *  curl -o /dev/null -s 'http://my.host.name/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=USERNAME&pass=PASSWORD'

In your situation I'd probably test out what some settings that might work were, by doing something like:
  • set the batch limit higher than you'd usually do (say 500)
  • run the cron job manually a few times with 'time'
    time curl -o /dev/null -s 'http://my.host.name/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=USERNAME&pass=PASSWORD'

That should tell you what settings your system is capable of handling. This will really depend on whether you're running a local mailserver, or a remote one (and: how remote).

Then, halve the batch limit and multiply the time you expect each run to take - if it only took 45 seconds to run the batch, I'd allow it five minutes; if it took more I'd probably allow ten minutes, or more.

Hope that helps. This is fairly unscientific by the way, but hopefully it'll give you an idea of how to identify some limits that will work for you!
@xurizaemon ● www.fuzion.co.nz

crayon

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.2
  • MySQL version: 5.0.91
  • PHP version: 5.2.17
Re: Cron Daemon
August 27, 2008, 08:45:28 am
It worked for me - thanks!

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: Cron Daemon
September 27, 2008, 06:55:05 pm
I found this a really useful thread. However, I was not clear how to determine the batch size. I am using wget and have therefore adopted this:

wget --spider -q 'http://my.host.name/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=USERNAME&pass=PASSWORD'

Thanks
« Last Edit: September 28, 2008, 04:21:38 am by Dave Smith »
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Cron Daemon
September 28, 2008, 05:15:10 am
Batch size is edited via Admin => CiviMail => Mailer Settings
@xurizaemon ● www.fuzion.co.nz

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Re: Cron Daemon
September 28, 2008, 06:56:32 am
Any idea what an optimal batch size might be?  For now we are set at 50 emails every 10 minutes, but I have no idea if we might be better at 5 emails every 1 minute or 300 every hour.

Dave

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cron Daemon
September 28, 2008, 07:26:59 am

I would set the batch size depending on limits placed by the host. If the host has a limit of 250 emails / hour, i would set the batch size to 200 (or 225) and then the cron job for once an hour

if the host does not have any limit then i would leave the batch size as unset / 0 and let civimail deliver it as fast as possible

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Cron Daemon
September 29, 2008, 01:10:46 am
Quote from: Denver Dave on September 28, 2008, 06:56:32 am
Any idea what an optimal batch size might be?  For now we are set at 50 emails every 10 minutes, but I have no idea if we might be better at 5 emails every 1 minute or 300 every hour.

As Lobo pointed out, this must be weighted by yourself, based on (a) the host’s limits (if any), (b) the host’s performance capabilities and (c) your requirements for the promptness of the mailing.

If the limits are hour-based and the host doesn’t have any performance problems when handling 300 emails at a given time I’d go with sending a bit below the limit (as Lobo suggests) every hour, but if the host acts better with lower load (and it’s not crucial that the recipients get their emails ASAP), you might want to go with 50 emails every 10 minutes (or five emails every minute).

(Note that the above counts are rather small, and neither should pose any performance problems; I’m writing more about the general case.)
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

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

This forum was archived on 2017-11-26.