Results 1 to 9 of 9

Thread: Periodic Command Scheduler

  1. #1
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default 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)

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default 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
    Consulenza Contao CMS https://www.intco.it

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Periodic Command Scheduler

    Thanks ga.n,
    just a question....
    if no-one visits the site, will this still be triggered? (i presume not)

  4. #4
    User
    Join Date
    06-19-09.
    Posts
    328

    Default 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
    Consulenza Contao CMS https://www.intco.it

  5. #5
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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?

  6. #6
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default 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.

  7. #7
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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...

  8. #8

    Default 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
    Extensions: avatar, cron, dlstats, editarea, geshi, helpdesk, recall, rep_*, smhcheck.
    FAQ's - Documents - Tickets
    Please no help requests by PM, use the forum or ticket link above instead!

  9. #9
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •