Luigi Micco

Strumenti Utente

Strumenti Sito

Barra laterale

I miei progetti


Se quello che hai trovato in queste pagine ti e\' stato in qualche modo d\'aiuto, puoi contribuire con una donazione!


oppure puoi cliccare su uno dei banner presenti qui.


Cronojob plugin

A plugin for schedule jobs

Download and Installation

Download and install the plugin using the DokuWiki Plugin Manager using the URL given above. Refer to :DokuWiki Plugins on how to install plugins manually.


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:

  • here is no user column
  • the executed command has to be an include()able file (which may contain further PHP code)


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”).

Version history

  • 2010-04-22 (current)
    • runs any PHP script periodical or time-controlled script execution
    • logs all executed jobs
    • run from an IMG tag in an HTML page
    • follows Unix cron syntax for crontabs
    • can sends an email with the results
    • the number of jobs run during one call of cronojob can now be limited.
    • sample script “clearcache”, that clear older cache and lock files
dokuwiki/cronojob.txt · Ultima modifica: 21/03/2019 22:44 (modifica esterna)

Strumenti Pagina