Crontab
The application implements a time-based job scheduler named Crontab. In the crontab view, there is a set of jobs that are executed periodically at fixed times or intervals.
Crontab jobs typically automate application maintenance or administration.
Crontab is shown in a table.
Name |
Expression |
Mime |
File name |
|
Last begin |
Last end |
Active |
Crontab parameters
Field | Description | Required |
---|---|---|
Name |
Job name. |
true |
Expression |
Sets when the job is executed. It takes into account the status of the application when the task will be executed. For example, if you stop the application at 00:00 to perform a backup, the task is delayed until the backup process is completed. |
true |
Class name |
More information at Creating your own Crontab plugin. |
true |
|
When present, an email is sent as part of the task once the execution has been completed. You can use several email addresses separated by a comma (","). |
false |
Last begin |
Shows the last time a process started. |
- |
Last end |
Shows the last time a process was completed. |
- |
Active |
Enables or disables execution of the process. |
true |
Understanding expression syntax
More information: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.htm
The commands are executed by cron when the minute, hour, and month fields match the current time, and when at least one of the two day fields (day of month, or day of week) matches the current time. The scheduler examines crontab entries once every minute. The time and date fields are:
* * * * * * command to execute
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ????? day of week (MON, TUE, WED, THU, FRI, SAT, SUN)
? ? ? ? ?????????? month (1 - 12)
? ? ? ??????????????? day of month (1 - 31)
? ? ???????????????????? hour (0 - 23)
? ????????????????????????? min (0 - 59)
????????????????????????????? seconds (0 - 59)
Field | Values |
---|---|
seconds |
0-59 |
minute |
0-59 |
hour |
0-23 |
day of month |
1-31 |
month |
1-12 |
day of week |
MON, TUE, WED, THU, FRI, SAT, SUN |
Samples
"0 0 * * * *" = every hour of every day.
"*/10 * * * * *" = every ten seconds.
"0 0 8-10 * * *" = 8, 9 and 10 o'clock of every day.
"0 0 6,19 * * *" = 6:00 AM and 7:00 PM every day.
"0 0/30 8-10 * * *" = 8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day.
"0 0 9-17 * * MON-FRI" = on the hour during nine-to-five weekdays.
"0 0 0 25 12 ?" = every Christmas Day at midnight
Create a new crontab job
A crontab job is based on a plugin architecture.
More information at Creating your own Crontab plugin.
Edit a crontab job
- Click on the
Edit crontab job icon.
- Modify the fields.
- Click on the Edit button.
Execute a crontab job
- Click on the
Execute crontab job icon.
Delete a crontab job
A crontab job is based on a plugin architecture deployed in $TOMCAT_HOME/plugins. You must delete the jar file in the plugin folder to remove the associated crontab job.