Periodic Command Scheduler
I read in the old forum that typolight has a "Periodic Command Scheduler" that can be called by modules, but I can't find any info on it.
I have 2 php scripts that I want to run once daily as part of a module i'm making.
Where in the module structure would I place the scripts, and how would I call PCS to run them once a day?
Cheers, murray
(ps I'd rather not use a server cron job, or Acenes's Cron module plugin as I want them to run self-sufficiently as part of the module)
Re: Periodic Command Scheduler
Quote:
Originally Posted by ramjet
I read in the old forum that typolight has a "Periodic Command Scheduler" that can be called by modules, but I can't find any info on it.
add an array('YourClass", "yourMethod") into $GLOBALS['TL_CRON']['daily'] (in config.php)
as done by some backend modules:
http://dev.typolight.org/browser/trunk/ ... g.php#L187
Re: Periodic Command Scheduler
Thanks ga.n,
just a question....
if no-one visits the site, will this still be triggered? (i presume not)
Re: Periodic Command Scheduler
Quote:
Originally Posted by ramjet
Thanks ga.n,
just a question....
if no-one visits the site, will this still be triggered? (i presume not)
I presume not too ;)
Re: Periodic Command Scheduler
I want to run an hourly job to check certain events being in a range and send out reminders... I know how to add the class to the cron array, but for the life of me, I can't figure out how the localconfig.php cron parameters ($GLOBALS['TL_CONFIG']['cron_hourly']) are used to run hourly jobs? there is a check in the cron.php file for a match and if the hourly value doesn't match the cron class isn't executed.
Code:
}
elseif (count($GLOBALS['TL_CRON']['hourly']) && $GLOBALS['TL_CONFIG']['cron_hourly'] != $intHourly)
{
I actually want to run this job as part of an actual cron, so these parameters need to be setup anyway, to allow the cron to work (actually call the class) -- of course I'll remove the cron.php image from the fe_page.tpl.
Anyone? I believe that this should be documented more so we understand what we have to do?
EDIT:
Maybe these imply skipps, rather then runs due to the !=, right?
Re: Periodic Command Scheduler
Not sure Thyon,
i ended up just using a real Unix cron as i needed everything to happen regularly at a specific time.
My understanding is that the Typolight cron queues jobs waiting for a site hit to trigger them, so you may have twenty jobs happen at once if theres been no site traffic for 20 hours for example.
Re: Periodic Command Scheduler
I still want to run the cron within the cron.php content, or maybe I should just create my own php file to run the cron job within the TL context (like the cron.php does it, e.g. initialise, objects...
Re: Periodic Command Scheduler
Sorry I cant help with the standard cron.php, just wanted to mention there is also a cron extension with more fine control over the schedules. In the docs you will find information how to build own jobs, and there is s sample job included.
Docs:
http://contifex.com/wiki/extensions/cron
Repository:
http://www.typolight.org/extension-list ... on.en.html
Re: Periodic Command Scheduler
It was easy, just made a copy, directly imported the library and method (with leo adding a log entry as well), and then the cron-reminder.php was ready.... Then we just added it to the crontab using a special php5-cgi script that can run PHP files directly... Thanks leo.