Difference between revisions of "Crontab"
m |
|||
Line 6: | Line 6: | ||
{{Advice|If you want to test an execution, click on the execute action (flash icon) and this will force the execution. If you have specified an email address, this email also will be sent.}} | {{Advice|If you want to test an execution, click on the execute action (flash icon) and this will force the execution. If you have specified an email address, this email also will be sent.}} | ||
− | When you create or modify a scheduled task, the ''last start'' and ''last stop'' entries | + | When you create or modify a scheduled task, the ''last start'' and ''last stop'' entries reseted if you upload a new task definition. Script may be BeanShell (for little amount of code) or a packet Jar (for more complex logic or bigger scripts). The daemon will look for the '''Main-Class''' attribute in the Jar's '''META-INF/MANIFEST.MF'''. |
<center>[[File:Okm admin crontab 02.png|370px]]</center> | <center>[[File:Okm admin crontab 02.png|370px]]</center> | ||
− | {{Warning|Only active tasks will be | + | {{Warning|Only active tasks will be executed periodically. If you don't want a task to be execute, simple mark it as inactive or remove it.}} |
== Expression syntax == | == Expression syntax == | ||
− | Commands are executed by cron when the minute, hour, and month | + | 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: |
Line 38: | Line 38: | ||
Lists are allowed. A list is a set of numbers (or ranges) separated by commas. Examples: ""1,2,5,9", "0-4,8-12". | 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 | + | 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. | 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. |
Revision as of 16:03, 15 September 2011
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.
If you want to test an execution, click on the execute action (flash icon) and this will force the execution. If you have specified an email address, this email also will be sent. |
When you create or modify a scheduled task, the last start and last stop entries reseted if you upload a new task definition. Script may be BeanShell (for little amount of code) or a packet Jar (for more complex logic or bigger scripts). The daemon will look for the Main-Class attribute in the Jar's META-INF/MANIFEST.MF.
Only active tasks will be executed 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 * * * *" |