Cron job setup best practice

Author Message

Eirik Alfstad Johansen

Friday 01 July 2011 5:49:03 am

Hi,

I'm curious as to what is the best practice for cron job setup, by which I mean which cron jobs that should be run, and how often.

I am of course aware that this varies depending on the site, and I have also gone through the docs at eZ any. However, what I'm missing is a mention of which cron jobs that should be run regulary (regardless of functionality) to ensure a clean and smooth running eZ Publish web site.

So, how are you guys configuring your cron jobs?

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Jérôme Vieilledent

Friday 01 July 2011 6:18:51 am

Hi Eirik

The basics would be to setup your crontab with something like what's in ezpublish.cron fil (inside your eZ root, aside to index.php) :

# This must be set to the directory where eZ Publish is installed.
EZPUBLISHROOT=/path/to/the/ez/publish/directory

# Location of the PHP Command Line Interface binary.
PHP=/usr/local/bin/php

# Instruct cron to run the main set of cronjobs
# at 6:35am every day
35 6 * * * cd $EZPUBLISHROOT && $PHP runcronjobs.php -q 2>&1

# Instruct cron to run the "infrequent" set of cronjobs
# at 5:20am every Monday
20 5 * * 1 cd $EZPUBLISHROOT && $PHP runcronjobs.php -q infrequent 2>&1

# Instruct cron to run the "frequent" set of cronjobs
# every 15 minutes
0,15,30,45 * * * * cd $EZPUBLISHROOT && $PHP runcronjobs.php -q frequent 2>&1

For your own cronjobs, well it's up to you and what does your script, of course. Just be aware that a cronjob cannot be run several times at once (mutex protection).

Eirik Alfstad Johansen

Friday 01 July 2011 6:37:29 am

Hi Jérôme,

Thanks for the reply. However, I'm not asking how to set up a cron job from a technical perspectice, but rather which specific cronjobs that should be a part of the frequent and less frequent cron job parts.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Jérôme Vieilledent

Friday 01 July 2011 7:12:38 am

Hi Eirik

No offenese, that was actually the purpose of my previous reply, to show you the basic cronjobs to make eZ Publish work properly :

  • frequent - every 15 min, or less
  • main set (runcronjobs.php without argument) - once a day (preferably during the night, but depends on the targeted audience)
  • infrequent - once a week

Gaetano Giunta

Monday 04 July 2011 9:34:28 am

Looking at the cronjobs in the "standard" groups:

- frequent: notifications - needed if users can subscribe to notifications

- frequent: workflows - needed if workflows are in place

- ezflow: ezflow - needed if you run ezflow

- standard: unpublish: if you use time-based depublication of content

- standard: hide: if you use time-based hiding of content

- standard: rssimport: if you set up import of content via rss feeds

- standard: indexcontent: if you use DelayedIndexing only

- standard: subtreeexpirycleanup: only needed if you enable some obscure clustering/storage parameter

- standard: internal_drafts_cleanup: I never understood what are internal drafts, but you'd better leave this on

- infrequent: basket_cleanup: only if you have webshop enabled

- infrequent: linkcheck: I've never seen an editor actually going to check the results of that script and fixing the broken links...

Now that I've done my part, a task for you community peeps: add a --list option to runcronjobs.php that would list all cronjobs parts and scripts contained in each one. Who wanna git a little bit?

Principal Consultant International Business
Member of the Community Project Board

Nicolas Pastorino

Monday 04 July 2011 9:40:24 am

"

Now that I've done my part, a task for you community peeps: add a --list option to runcronjobs.php that would list all cronjobs parts and scripts contained in each one. Who wanna git a little bit?

"

Awesome idea.

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Romain Petit

Friday 29 July 2011 8:34:00 am

Hi,

You may add "session_gc.php" to the infrequent part.
Otherwise it seems that the session table grows indefinitely.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.