I miei progetti
A plugin for schedule jobs
The cronojob plugin allow to schedule jobs to run to a specific time, using a modified version of pseudo-cron PHP library.
Usually regular tasks like backup up or site maintenaince are run using cron jobs. With cron jobs, you can exactly plan when a certain command is to be executed. But most homepage owners can't create cron jobs on their web server – providers demand some extra money for that.
The only thing that's certain to happen quite regularly on a web page are page requests. This is where cronojob comes into play: with every page request it checks if any cron jobs should have been run since the previous request. If there are, they are run and logged.
Cronojob uses a syntax very much like the Unix cron's one. For an overview of the syntax used, see the cronotab syntax. The syntax used by this plugin is different from the one described on that page in the following points:
All job definitions are made by the admin's side configuration. Here is an example of a valid crono table configuration:
#comments start with '#' #mi h d m dow job comment 0 5 * * Sun dump.php # make db dump every sunday at 5 am 40 5 2 * * sendlog.php # send last month's web server logs */15 8-19 * * Mon-Fri refr_ext.php # refresh external news sources
The last line will call refr_ext.php every 15 minutes between 8am and 7pm on Monday to Friday.
Write a PHP script that does the job you want to be run regularly. Put this file into lib/plugins/cronojob/jobs folder. Set up your crono table configuration with your script. Wait for the next scheduled run :)
You can log messages from your job script to Cronojob's log file by calling logMessage(“log a message”).