1. define the time bar using crontab-e to compile the scheduled task. the format is: reference the first five digits of the *** command, the minimum interval between minute, hour, day, month, and week cron is one minute. that is, the cron service checks the information of scheduled tasks saved in the system every minute. The time bar is defined as: referencing fieldallowedvalues ----- & nb
I. definition of time bar
You can use crontab-e to compile scheduled tasks in the following format:
Reference *** command
The first five signs (*) indicate minute, hour, day, month, and week.
The minimum interval between cron services is one minute, that is, every minute the cron service checks information about the scheduled tasks saved in the system.
The time bar is defined:
Reference field allowed values
-------------------
Minute 0-59
Hour 0-23
Day of month 1-31
Month 1-12 (or abbreviated month)
Day of week 0-7 (0 or 7 is Sunday, or use abbreviation)
If it indicates a range, you can use:
Reference * indicates all, any match;
-Indicates the range. for example, in the minute column, the value ranges from 0 to 10;
/Indicates the interval. for example, in the minute column, */5 means every 5 minutes, in the hour column, 0-23/2 means every 2 hours;
II. macros
In addition to the preceding statement, you can also use the definition of "nicknames:
Reference @ reboot: Run once, at startup.
@ Yearly: Run once a year, ie. "0 0 1 1 *".
@ Annually: Run once a year, ie. "0 0 1 1 *".
@ Monthly: Run once a month, ie. "0 0 1 **".
@ Weekly: Run once a week, ie. "0 0 ** 0 ".
@ Daily: Run once a day, ie. "0 0 ***".
@ Hourly: Run once an hour, ie. "0 ****".
III. example
Run once every 15 minutes:
Reference */15 */opt/test. sh
, */Opt/test. sh
Run the following command at 00:00 every day:
Reference @ daily/opt/test. sh
0 0 ***/opt/test. sh
Automatic execution at startup (equivalent to put in rc. local ):
Reference @ reboot/opt/test. sh
For more information, see man 5 crontab.