Task Scheduling on Linux
Task Scheduler: Perform a task at a time in the future: at, Batch
To perform a task periodically: crontab
Email service
Smtp:simple Mail Transmission protocol
/var/spool/mail/username
Mail command
Mail: An excuse to enter interactive email
Mail-s ' subject ' [email protected]
Mail-s ' subject ' [email protected] </path/from/somefile
Command | mail-s ' subject ' [email protected]
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C7/wKiom1XtItrS3-9AAAIUwWmcT-8587.jpg "title=" 1.png " alt= "Wkiom1xtitrs3-9aaaiuwwmct-8587.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C7/wKiom1XtI1PjbUphAAJxCKqL5LY932.jpg "title=" 1.png " alt= "Wkiom1xti1pjbuphaajxckql5ly932.jpg"/>
AT command
A job that hosts the next time run
Support for using the default job queue
CTRL + D exit
At "option" ... time
Time
1: Absolute Time
hh:mm mmdd "CC" YY
2: Relative time
now+ Minute/hour/day/week
3: Blur Time
Midnight Noon Teatime
Common options
-q:at Job Queue
-F:/path/fuom/somefile read files to be executed from the specified file
-C: View Run job contents
-D: Delete the specified job
Batch: There is a system that chooses to run the specified task at the time of the space
Crontab: Recurring Task Schedule
Daemon: Crond
There are two types of recurring tasks:
(1) System cron task, do not run the user identity by default, so you need to specify the additional runner
/etc/crontab
# Example of Job definition:
#.----------------Minute (0-59)
# | .-------------Hour (0-23)
# | | .----------Day of Month (1-31)
# | | | .-------month (1-12) OR jan,feb,mar,apr ...
# | | | | .----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * * user-name command to be executed
7 fields:
1-5: Specify a point in time
6: Run task with that user's identity
7: The task to run
5 Time points:
Minutes: Valid value range 0-59
Hours: 0-23
Day: 1-31
Month: 1-12
Weeks: 0-7
Note: Several months and weeks cannot be used simultaneously
Time Representation Method:
*: Any time point in the valid value range for the point in time
-: Continuous range of time
,: Discrete time range
/#: Specify Frequency
(2) User Cron Task: Submitted by a user, the identity of the default submitter runs without additional designation
/var/spool/cron/username
VIM command: Not recommended
Crontab: Recommendations
crontab Command options:
-u User: Not managing your own tasks, but specifying cron tasks for target users, only for the root user
-L: List All Tasks
-R: Remove All Tasks
-E: Edit cron Task table
Note: (1) If you do not want to perform any notification messages for results
COMMAND >/dev/null
COMMAND &>/dev/null
(2) for the crontab file,% has a special function, if you need to use the escape character
(3) Crontab applicable decision Path
2, every Monday to Saturday 3:20 A.M., run the CP command to archive the/etc/directory, storage location is/BACKUPS/ETC-YYYY-MM-DD;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CC/wKiom1XtUKnQH2vQAADOboyFcT4098.jpg "title=" 1.png " alt= "Wkiom1xtuknqh2vqaadoboyfct4098.jpg"/>
3, every Sunday 2:30 A.M., run the CP command to backup the/etc/fstab file, the storage location is/BACKUP/FSTAB-YYYY-MM-DD-HH-MM-SS;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/C9/wKioL1XtVNSQ9XsvAACNKhy0vmI714.jpg "title=" 1.png " alt= "Wkiol1xtvnsq9xsvaacnkhy0vmi714.jpg"/>
4, every night 12 o'clock, get all the lines in the/proc/meminfo file starting with S or M, appended to the/statistics/meminfo.txt file, and the daily message before, to add a similar =============== separator line;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/CA/wKioL1XtWXvwbph6AACGnh3yb_I941.jpg "title=" 1.png " alt= "Wkiol1xtwxvwbph6aacgnh3yb_i941.jpg"/>
Linux Learning summary task plan