Difference between revisions of "Crontab"
(→Expression syntax) |
m (→Expression syntax) |
||
Line 14: | Line 14: | ||
== Expression syntax == | == 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: | 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: | ||
+ | |||
{| align="center" border="1" cellpadding="5" cellspacing="0" | {| align="center" border="1" cellpadding="5" cellspacing="0" | ||
Line 28: | Line 29: | ||
| day of week || 0-7 (0 or 7 is Sun, or use names) | | 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''. | A field may be an asterisk (*), which always stands for ``first-last''. | ||
Line 42: | Line 44: | ||
Instead of the first five fields, one of eight special strings may appear: | Instead of the first five fields, one of eight special strings may appear: | ||
+ | |||
{| align="center" border="1" cellpadding="5" cellspacing="0" | {| align="center" border="1" cellpadding="5" cellspacing="0" | ||
Line 60: | Line 63: | ||
| @hourly || Run once an hour, "0 * * * *" | | @hourly || Run once an hour, "0 * * * *" | ||
|} | |} | ||
+ | |||
[[Category: Administration Guide]] | [[Category: Administration Guide]] |
Revision as of 12:50, 29 November 2010
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.
When you create or modify am scheduled task, the last start and last stop entries resetted if you upload a new task definition.
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.
Instead of the first five fields, one of eight special strings may appear:
String | Meaning |
---|---|
@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 * * * *" |