Running crontabs

Author Message

cliffp pratt

Thursday 22 April 2010 4:54:21 pm

I'm upgrading to 4.2 from 3.8. I'm trying to move some custom crontabs and I can't get them to run!

I've created a settings/override/crontab.ini.append.php, created a directory within extensions and moved the script there. I've then tried to run runcrontabs.php from the command line and get the following:

myserver>>: /sysmanage/data/www/ezpublish-4.2.0# $PHPCLI runcronjobs.php -dall exportcsv
Running cronjob part 'exportcsv'
#################################### DEBUG ####################################
Debug: (eZMySQLDB::query(0.000 ms) query number per page:0)
SET NAMES 'utf8'
No timing points defined
Peak memory usage: 6,120.4297 KB
Group ini_load:
Load cache: 0.0047 sec (7.7304%), 0.0012 avg sec (4)
FindInputFiles: 0.0016 sec (2.6515%), 0.0004 avg sec (4)
Group Mysql Total:
Mysql_queries: 0.0007 sec (1.1935%), 0.0002 avg sec (3)
Total script time: 0.0603 sec

If I run the command with an invalid name for the override section it complains:

Notice: No scripts found for execution.

If I put an invalid script name in the crontab.ini.append.php it runs with no messages.

So from the above it appears to be finding the override files, but for some reason the script appears to be ignored.Has anyone got any ideas?

Here's the cronjob part in question:

[CronjobPart-exportcsv]
ExtensionDirectories[]=exportcsv
Scripts[]=exportcsv.php
Cheers,

Cliff

cliffp pratt

Wednesday 28 April 2010 9:28:07 pm

Update - I can run cronparts as long as they are in the base settings/crontab.ini. Can anyone please help?

Cheers,

Cliff

Paul Leclercq

Wednesday 05 May 2010 8:10:21 am

You seem to have got something badly wrong here, this is the setting you should be using:

[CronjobSettings]
ExtensionDirectories[]=exportcsv
[CronjobPart-exportcsv]
Scripts[]=exportcsv.php

you then execute your cronpart from the root of your project this way:

php runcronjobs.php exportcsv

In that exemple the name of your cronpart is just behind the
[CronjobPart-NAME_OF_CRONPART]

php runcronjobs.php NAME_OF_CRONPART

If you then wish to run this from a crontab you will need to do write something like this in your /etc/crontab file:

-------------------------------------------------------
# This must be set to the directory where eZ Publish is installed.
EZPUBLISHROOT=/var/www/myproject_name/www
# Location of the PHP Command Line Interface binary.
PHP=/usr/bin/php

# Every ten minutes
*/10 * * * * su - www-data -c "cd $EZPUBLISHROOT && $PHP runcronjobs.php ezflow" > /tmp/ezflow.cron.log 2>&1

----------------------------------------------------------

But you have much better information here:
http://ez.no/doc/ez_publish/technical_manual/4_x/features/cronjobs/running_cronjobs

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