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.

eZ debug

Timing: Jan 18 2025 00:04:36
Script start
Timing: Jan 18 2025 00:04:36
Module start 'layout'
Timing: Jan 18 2025 00:04:36
Module start 'content'
Timing: Jan 18 2025 00:04:37
Module end 'content'
Timing: Jan 18 2025 00:04:37
Script end

Main resources:

Total runtime0.7065 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.4609152.6406
Module start 'layout' 0.00550.0036 742.101639.4844
Module start 'content' 0.00910.6959 781.5859723.9453
Module end 'content' 0.70510.0014 1,505.531320.1484
Script end 0.7065  1,525.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.5078160.0002
Check MTime0.00140.1999160.0001
Mysql Total
Database connection0.00080.114410.0008
Mysqli_queries0.630389.2072750.0084
Looping result0.00080.1150730.0000
Template Total0.676695.820.3383
Template load0.00200.289220.0010
Template processing0.674695.476220.3373
Template load and register function0.00010.014410.0001
states
state_id_array0.00030.045010.0003
state_identifier_array0.00080.119220.0004
Override
Cache load0.00190.2632530.0000
Sytem overhead
Fetch class attribute can translate value0.00080.118450.0002
Fetch class attribute name0.00090.1328110.0001
XML
Image XML parsing0.00200.277250.0004
class_abstraction
Instantiating content class attribute0.00000.0032130.0000
General
dbfile0.00110.1510350.0000
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
3content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 35
 Number of unique templates used: 11

Time used to render debug report: 0.0002 secs