This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Developer » eZ Flow automatic rotation - cronjob...
expandshrink

eZ Flow automatic rotation - cronjob [SOLVED]

eZ Flow automatic rotation - cronjob [SOLVED]

Monday 27 February 2012 5:02:08 pm - 11 replies

Hi there,

I am using eZ Flow and I'd like to enable automatic rotation of the articles added into a block, for which, I guess, I need to run cronjob, but I am having little troubles here..

The cronjob.ini.append.php inside /extension/ezflow/settings has its original setting:

[CronjobSettings]
ExtensionDirectories[]=ezflow
 
[CronjobPart-ezflow]
Scripts[]=ezflowupdate.php
 
[CronjobPart-ezflow-cleanup]
Scripts[]=ezflowcleanup.php

For me this is the very first time I try to set a cronjob in eZ Publish and I am not really sure I am handling it in the right way. Anyway, I followed the documentation and run this command line from shell

/usr/bin/php /var/www/vhosts/domainname.it/httpdocs/runcronjobs.php ezflow

but got this error

PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Fatal error:  Class 'ezcBaseOptions' not found in /var/www/vhosts/domainname.it/httpdocs/kernel/private/options/ezpextensionoptions.php on line 57
 
Fatal error: eZ Publish did not finish its request
The execution of eZ Publish was abruptly ended, the debug output is present below.

Any help would be as always highly appreciated. Thanks!

Modified on Sunday 04 March 2012 3:19:58 pm by Lo' F.

Monday 27 February 2012 5:53:55 pm

Well, I tried something else..

There is that ezpublish.cron file in the root directory of eZ Publish installation inside which I added the following instruction, after setting the actual php and ezpublish paths

# Instruct cron to run the "ezflow" set of cronjobs
# every minute
*/1 * * * * cd $EZPUBLISHROOT && $PHP runcronjobs.php -q ezflow 2>&1

but when i ran the ssh command, from inside the ez publish directory,

crontab ezpublish.cron

it returned this error

"ezpublish.cron":21: premature EOF
errors in crontab file, can't install.

ezflow there is the set of cronjobs set inside the /extension/ezflow/settings/cronjob.ini.append.ini

[CronjobPart-ezflow]
Scripts[]=ezflowupdate.php

What's wrong with it?

 

Another thing I forgot to ask:

This automatic rotation thing does actually rotate the queued articles by refresching the page automatically or how else? Thanks..

Modified on Monday 27 February 2012 6:03:29 pm by Lo' F.

Tuesday 28 February 2012 9:47:48 am

Which Version do you use?

Tuesday 28 February 2012 1:22:03 pm

eZ Flow 2.4.0

eZ Publish Community Project 2011.12

Modified on Tuesday 28 February 2012 1:23:13 pm by Lo' F.

Tuesday 28 February 2012 2:02:11 pm

It seems to me that the ezpublish.cron file is not correctly formatted (it could be missing an end-of-line character at the end).

You can try just adding carriage return (enter) at the end of the last line in the file.

Modified on Tuesday 28 February 2012 2:03:02 pm by Igor Vrdoljak

Tuesday 28 February 2012 6:04:22 pm

Hi

Ithink this should be executed from in eZDOC_ROOT:

EZROOT=/var/www/vhosts/domainname.it/httpdocs/
*/1 * * * * cd $EZROOT && /usr/bin/php runcronjobs.php -s[your_siteaccess] ezflow

instead of

/usr/bin/php /var/www/vhosts/domainname.it/httpdocs/runcronjobs.php ezflow

Does this Help ?

can you see if ezc is loaded?

Modified on Tuesday 28 February 2012 6:06:34 pm by Ousmane KANTE

Wednesday 29 February 2012 5:24:54 pm

Thanks to all for your replies.

After several attempts I think I have had the cronjobs up and running from what I can see by calling the crontab -l command

[root@xx httpdocs]# crontab -l
# This must be set to the directory where eZ Publish is installed.
EZPUBLISHROOT=/var/www/vhosts/domainname.it/httpdocs
 
# Location of the PHP Command Line Interface binary.
PHP=/usr/bin/php
 
...
 
# Instruct cron to run the "ezflow" set of cronjobs
# every minute
*/1 * * * * cd $EZPUBLISHROOT && $PHP runcronjobs.php -q ezflow 2>&1

but it doesn't actually do what I was expecting. I mean wasn't that instruction supposed to reload the page after every minute to rotate the queued articles set inside a block?

The article in the online section stands still, it doesn't change, instead it does it only when I edit and publish the frontpage object again. If that's the automatic rotation logic, definitely there might be something wrong in what I am doing...

 

p.s. Ousmane, I am not sure what you mean for checking whether ezc is loaded, could you please explain? How? and what is that exactly?

Wednesday 29 February 2012 10:24:19 pm

My latest attempt was to create an override of the cronjob.ini file inside /setting/siteaccess/ita/ directory, which is the used siteaccess for the front-end, passing this setting

[CronjobSettings]
#ScriptDirectories[]=extension/ezflow/cronjobs
ExtensionDirectories[]=ezflow
Scripts[]=ezflowupdate.php

which should instruct to run any script set in the cronjob.ini.append.php inside the ita siteaccess, but yet when I launch the command from shell I get this error

[root@xx httpdocs]# /usr/bin/php runcronjobs.php -s ita
Using siteaccess ita for cronjob
An unexpected error has occurred. Please contact the webmaster.

I also set the permission to execute of ezflowupdate.php thinking that it could have depended on that but it didn't change anything anyway...

Thursday 01 March 2012 4:31:01 pm

On my third day spent on trying to figure out what the problem can be I can see that when I run the command in a friendly "output mode" I get this..

[root@xx httpdocs]# /usr/bin/php runcronjobs.php -d -s ita
Using siteaccess ita for cronjob
Segmentation fault

which means....?!

Anybody...please!

Thursday 01 March 2012 5:40:29 pm

From what I can read googling for segmentation fault,
a segfault is by definition an unhandled error, so the logs are unlikely to tell you much ...

It seems it could to be related to php....

I am running on php 5.2.17

[root@xx ~]# php -v
PHP 5.2.17 (cli) (built: Jan  7 2011 08:49:48) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

with memory limit originally set to 256M

[root@xx ~]# grep memory_limit /etc/php.ini
memory_limit = 256M

I also tried setting those limit to 2048M ;P but it didn't help much as I keep getting the same error...

Modified on Saturday 03 March 2012 9:55:56 pm by Lo' F.

Friday 02 March 2012 10:55:18 pm

What prevented the cronjob from running was SAFE MODE master value turned on.

I simply set the value to off in the php.ini file and that did the trick. blunk.gif Emoticon

By launching either each of the cron commands now it works just fine happy.gif Emoticon

1)

[root@62 httpdocs]# /usr/bin/php runcronjobs.php -d -s ita
Using siteaccess ita for cronjob
...
Running extension/ezflow/cronjobs/ezflowupdate.php at: 02/03/2012 11:40
Updating ezm_pool
Completing extension/ezflow/cronjobs/ezflowupdate.php at: 02/03/2012 11:40
Elapsed time: 00:00:00

2)

[root@62 httpdocs]# crontab ezpublish.cron
 
[root@62 httpdocs]# crontab -l
# This must be set to the directory where eZ Publish is installed.
EZPUBLISHROOT=/var/www/vhosts/domainname.it/httpdocs/
 
# Location of the PHP Command Line Interface binary.
PHP=/usr/bin/php
 
 
# Instruct cron to run the "ezflow" set of cronjobs
# every minute
*/1 * * * * cd $EZPUBLISHROOT && $PHP runcronjobs.php -s ita -q 2>&1

Cool... happy.gif Emoticon happy.gif Emoticon

Now the only thing left to solve is that when I try to run the cronjob from Plesk setting the path in the command line

/usr/bin/php -q /var/www/vhosts/domainname.it/httpdocs/runcronjobs.php‏

it sends this error...

PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Warning:  in_array(): Wrong datatype for second argument in /var/www/vhosts/domainname.it/httpdocs/kernel/classes/ezscript.php on line 1084
PHP Fatal error:  Class 'ezcBaseOptions' not found in /var/www/vhosts/domainname.it/httpdocs/kernel/private/options/ezpextensionoptions.php on line 57
 
Fatal error: eZ Publish did not finish its request
The execution of eZ Publish was abruptly ended, the debug output is present below.

Same if I try to run ezflowupdate.php directly (...can I?)

/usr/bin/php -q /var/www/vhosts/domainname.it/httpdocs/extension/ezflow/cronjobs/ezflowupdate.php‏

Get this..

PHP Notice:  Undefined variable: isQuiet in /var/www/vhosts/domainname.it/httpdocs/extension/ezflow/cronjobs/ezflowupdate.php on line 25
PHP Notice:  Undefined variable: cli in /var/www/vhosts/domainname.it/httpdocs/extension/ezflow/cronjobs/ezflowupdate.php on line 27
PHP Fatal error:  Call to a member function output() on a non-object in /var/www/vhosts/domainname.it/httpdocs/extension/ezflow/cronjobs/ezflowupdate.php on line 27

Any idea here?

Not really an eZ issue but if somebody knows where the solution may lay and would be willing to share that would be great. Thanks! blunk.gif Emoticon

Modified on Saturday 03 March 2012 9:54:26 pm by Lo' F.

Sunday 04 March 2012 3:17:24 pm

...aaand SOLVED! happy.gif Emoticon

Still don't know why but the command line which need to be passed to schedule a cronjob task may differ somehow from Plesk to Plesk...

This if the one that worked for me

cd  /var/www/vhosts/domainname.it/httpdocs/;  /usr/bin/php -q runcronjobs.php ezflow >/dev/null 2>&1

while this one didn't (though it's correct, anyway)

/usr/bin/php -q /var/www/vhosts/domainname.it/httpdocs/runcronjobs.php ezflow

Cheers! blunk.gif Emoticon

p.s. >/dev/null 2>&1 is to stop sending courtesy messages any time the cron runs..

Modified on Sunday 04 March 2012 3:18:46 pm by Lo' F.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from