Crontab is a convenient way to regularly (cyclically) execute a task on Unix/Linux systems.Program
Basic usage:
1. crontab-l
List the current crontab task
2. crontab-d
Delete the current crontab task
3. crontab-E (crontab-r above solaris5.8)
Edit a crontab task and ctrl_d ends.
4. crontab filename
Use filename as the crontab task list file and load it
Crontab file format:
Rows in the crontab file are composed of six fields. Different fields are separated by spaces or the tab key. The first five fields specify the time when the command will be run.
Minutes (0-59)
Hour (0-23)
Date (1-31)
Month (1-12)
Day of the week (0-6, 0 indicates Sunday)
The 6th fields are strings to be executed at the appropriate time
Example:
# Min hour day month dayofweek command
#06:10 every morning
10 6 **** date
# Every two hours
0 */2 *** date (Solaris 5.8 does not seem to support this method)
# Every two hours from PM to am, am
0 23-7/2, 8 **** date
# Am on the 4th day of each month and from Monday to Wednesday of each week
0 11 4 * Mon-wed date
# A.m. of July
0 4 1 Jan * Date
Note: When Using crontab, the environment variables that can be accessed in the running script may not be consistent with those in the current test environment, it is safer to set the environment variable (export) in the running script program)