Overview
Task scheduling: Refers to a particular command or program that the system executes at a certain time
Task Scheduling Classification:
-System work: Some important work must be performed periodically, such as virus scanning, etc.
-Individual users work: Individual users may want to perform certain programs
Task Dispatch commands
Set Task Scheduler file:/etc/crontab
Set up personal Task Scheduler, execute crontab ‐e Command, then enter task to dispatch file
"Case"5 * * * * ls ‐l/etc/>/tmp/to.txt, meaning to say five minutes per hour to execute the ls command
Rules for scheduling files
Field name |
Description |
Range |
Minutes |
The number of minutes per hour to execute |
0-59 |
Hours |
The first hours of the day are executed |
0-23 |
Date |
Day of the Month execution |
1-31 |
Calendar |
The month ordinal of the year is executed |
1-12 |
Week |
Day of the Week execution |
0-6 |
Using Task scheduling
-Set Tasks
-Crontab‐e
-Perform date >/home/mydate2 at certain intervals
-Want to go to the day of the morning 2:xx to perform date >>/home/mydate2, you can crontab ‐e added:0 2 * * * Date >>/home/mydate2
-Wish to execute every minute: Add in crontab ‐e :* * * * *date >>/home/mydate2
-How to schedule multiple tasks
- write multiple commands directly in Crontab ‐e (not recommended)
-Can put all tasks, write to an executable file (Shell programming)
-Terminate task scheduling
-Crontab‐r: Terminating task scheduling
-Crontab‐l: Lists which tasks are currently scheduled
Linux under Crontab detailed