Crontab

From OpenKM Documentation
Revision as of 12:43, 29 November 2010 by Pavila (talk | contribs)

Jump to: navigation, search

With this feature you can create scheduled task in a easy way. In this page you can see the already registered tasks. The last start and last stop columns show when the last time a task was executed. If you want to the the output of the script, you can set an email and you will be notified every time the task is executed.


Okm admin crontab 01.png


When you create or modify am scheduled task, the last start and last stop entries resetted if you upload a new task definition.


Okm admin crontab 02.png

Nota advertencia.png Only active tasks will be ejecuted periodically. If you don't want a task to be execute, simple mark it as inactive or remove it.

Expression syntax

Commands are executed by cron when the minute, hour, and month of year fields match the current time, and when at least one of the two day fields (day of month, or day of week) match the current time. The scheduler examines crontab entries once every minute. The time and date fields are:

field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names)

A field may be an asterisk (*), which always stands for ``first-last.

Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive. For example, 8-11 for an ``hours entry specifies execution at hours 8, 9, 10 and 11.

Lists are allowed. A list is a set of numbers (or ranges) separated by commas. Examples: ``1,2,5,9, ``0-4,8-12.

Step values can be used in conjunction with ranges. Following a range with ``/<number> specifies skips of the number's value through the range. For example, ``0-23/2 can be used in the hours field to specify command execution every other hour. Steps are also permitted after an asterisk, so if you want to say ``every two hours, just use ``*/2.

Names can also be used for the ``month and ``day of week fields. Use the first three letters of the particular day or month (case doesn't matter). Ranges or lists of names are not allowed.


Nota clasica.png The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (i.e., aren't *), the command will be run when either field matches the current time. For example, ``30 4 1,15 * 5 would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.

Instead of the first five fields, one of eight special strings may appear:

string meaning ------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually (same as @yearly) @monthly Run once a month, "0 0 1 * *". @weekly Run once a week, "0 0 * * 0". @daily Run once a day, "0 0 * * *". @midnight (same as @daily) @hourly Run once an hour, "0 * * * *".