Because of the test, recently had to touch the Java spring @Scheduled scheduled tasks, it was thought that the configuration of the expression and crontab is exactly the same, did not expect a bit different.
in spring , a cron expression has at least 6 or 7 space-delimited time elements.
As follows:
Example:
0 0/5 * * * is triggered every 5 minutes
0 15 10 * *? Triggered 10:15 daily
PS: Usage:
And then set it in the configuration file (such as the Application.properties file)
Can.
in Linux contab , it is a 5-bit time element, which represents the minute, time, day, month, and week respectively . The expression is followed by the command you want to execute.
*/5 * * * * * run.sh means to execute run.sh files every 5 minutes
Ps:crontab basic Commands
Crontab-l Viewing timed tasks
Crontab-e into the edit page
Crontab-r Removing timed tasks
Scheduled tasks for the Java Spring Framework