eZ Community » Forums » Discussions » Support to run cronjobs under...
expandshrink

Thursday 18 August 2011 4:28:42 pm - 2 replies

» Back to Roadmap

Description

At the moment a cronjob can be run below exactly one siteaccess. This causes several problems, where two important one are:
- When sending for example Emails, these emails will be sent in exactly one language (the one from the siteaccess used by the runcronjobs script)
- It is not easily possible to use one eZ Publish installation for more than one customer, because typically customers have different requirements (also concerning the cronjobs and their execution). If customer A needs a cronjob, customer B will also get it.
What we need are two improvements here:
- Especially for the Emails it should be possible to get the preferred language (and perhaps also other information) from the user object itself instead of the siteaccess.
- With respect to the workflows an information about the siteaccess below which an event has been created should be stored. The workflow should then only execute events having the same siteaccess as the one the runcronjobs script currerntly uses. (Yes, when thinking about an admin interface one must think about a solution).
In principle all cronjob scripts and perhaps also other shell scripts should be investigated, to see how they could be improved so that they can be executed in parallel at the same time but using a different siteaccess.

Wednesday 14 September 2011 12:59:58 pm

But this is already possible with -s siteaccess_name switch in shell.

Been using it forever to run certain cronjobs and php scripts for two databases in same eZ Publish install.

Thursday 14 June 2012 9:03:35 am

Yes it is possible to run a cronjob for a different siteaccess. That was one part of the question.

For this part we create a new php scrip runcronjob-multiple.php which uses a global ini setting which siteaccess in combination of  cronjob part should be run. The script is calling the original runcronjobs.php with -s paramater and the given crontpart.

So we have on our mutlisiteinstallaion > 50 sites (each site has a separate db) an easy setup to configure the cronjobs to run by ini.

In the crontab we only setup the cronjobs for  

php runcronjob-multiple.php frequent
 
php runcronjob-multiple.php hourlyphp runcronjob-multiple.php daily
 
php runcronjob-multiple.php weekly

The siteaccess for the cronparts is read from global cronjob.ini here is an example:  sa site1_admin will running the cronjob parts hourly and daily.

 [GlobalCronjobMultipleSettings]
# which siteaccesses should be use to run execute the cronjob
 
# frequent;hourly;daily;weekly
CronjobSiteAccessCronPartArray[site1_admin]=hourly;daily
CronjobSiteAccessCronPartArray[site2_admin]=frequent;hourly;daily;weekly

--

A problem is if you have one database with different sites in different languages and you want that your users get notifications messages in their language. Or you want in a multilanguageinstallation choose your user in which language he would get the notification. You can only run the cronjobs for 1 siteaccess e.g. admin at the moment. And the language of this sa will be used.

I think ez has to do some generell things in that case.

1. make it possible to switch a siteaccess on runtime so a script could be run as admin but can be render tpl and i18n ... with sa german or .... and can switch back (this is not possible at the moment - the only real working solution i found is to run a separate script on commandline with the -s (siteaccess) parameter.

2. a new user setting (preferend language) whick could be used in such a cronjob

But this are known problems i think. Hopefully this usecases could be solved in the upcoming ezpublish 5

expandshrink

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

36 542 Users on board!

Forums menu