crontab: can achieve levels of precision-minute scheduling
crontab -e: edit regular tasks
— | — | — | – | – | – |
---|---|---|---|---|---|
* | * | * | * | * | command |
minute | hour | day | month | week | |
00-59 | 00-23 | 1-31 | 1-12 | 0-7 | sh /tmp/test.sh |
- "3:00 every day to execute the script
00 03 * * * sh /tmp/test.sh
- "Every Sunday 12:30 to execute the program
30 12 * * 7 sh /tmp/test.sh
- "performed once every two hours
00 */2 * * * sh /tmp/test.sh
- "Every day 5:00 and 7:00 execution time
00 5,7 * * * sh /tmp/test.sh
- "Every day 5:00 to 7:00
00 5-7 * * * sh /tmp/test.sh
crontab -l: list of all currently scheduled tasks
crontab -r: delete all scheduled tasks
crontab -u root -f /tmp/test.txt:
Use test.txt file timed tasks as the root user