Forums / Install & configuration / Cron job setup best practice

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.

eZ debug

Timing: Jan 17 2025 21:12:18
Script start
Timing: Jan 17 2025 21:12:18
Module start 'content'
Timing: Jan 17 2025 21:12:19
Module end 'content'
Timing: Jan 17 2025 21:12:20
Script end

Main resources:

Total runtime1.1631 sec
Peak memory usage4,096.0000 KB
Database Queries212

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 597.2813180.8359
Module start 'content' 0.00611.0519 778.1172768.6875
Module end 'content' 1.05810.1050 1,546.8047340.6797
Script end 1.1630  1,887.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.3375210.0002
Check MTime0.00150.1263210.0001
Mysql Total
Database connection0.00090.079410.0009
Mysqli_queries1.079392.79562120.0051
Looping result0.00190.16412100.0000
Template Total1.136197.720.5681
Template load0.00190.160720.0009
Template processing1.134397.522620.5671
Template load and register function0.00010.007610.0001
states
state_id_array0.00070.062310.0007
state_identifier_array0.00080.072720.0004
Override
Cache load0.00170.1438530.0000
Sytem overhead
Fetch class attribute can translate value0.00100.082460.0002
Fetch class attribute name0.00080.0701110.0001
XML
Image XML parsing0.00210.178660.0003
class_abstraction
Instantiating content class attribute0.00000.0014130.0000
General
dbfile0.00210.1790460.0000
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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