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 15 2025 09:10:57
Script start
Timing: Jan 15 2025 09:10:57
Module start 'layout'
Timing: Jan 15 2025 09:10:57
Module start 'content'
Timing: Jan 15 2025 09:10:59
Module end 'content'
Timing: Jan 15 2025 09:10:59
Script end

Main resources:

Total runtime1.4577 sec
Peak memory usage6,144.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 686.1016183.7031
Module start 'layout' 0.00570.0029 869.804752.6016
Module start 'content' 0.00861.4474 922.40631,997.6875
Module end 'content' 1.45610.0016 2,920.0938140.5313
Script end 1.4577  3,060.6250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00610.4159160.0004
Check MTime0.00130.0904160.0001
Mysql Total
Database connection0.00080.057410.0008
Mysqli_queries1.366993.7669750.0182
Looping result0.00080.0526730.0000
Template Total1.424197.720.7121
Template load0.00470.321320.0023
Template processing1.419497.371120.7097
Template load and register function0.00150.100410.0015
states
state_id_array0.00090.063310.0009
state_identifier_array0.00120.079820.0006
Override
Cache load0.00430.2944530.0001
Sytem overhead
Fetch class attribute can translate value0.00060.042050.0001
Fetch class attribute name0.00280.1900110.0003
XML
Image XML parsing0.00360.247250.0007
class_abstraction
Instantiating content class attribute0.00000.0017130.0000
General
dbfile0.00350.2388350.0001
String conversion0.00000.000640.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.0001 secs