Linux Task Scheduler
Task Schedule:
Perform a task at a time in the next point: At,batch
Recurring tasks: crontab
Email service
Smtp
/var/spool/mail/username
Pop3
Imap4
Mail command:
Mail: Enter the interactive send and receive mail interface.
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/M00/72/CF/wKiom1Xtg3SCWsFBA Anbqfydmc0454.jpg "title=" 36020150907203030505.jpg "alt=" Wkiom1xtg3scwsfbaanbqfydmc0454.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/CC/wKioL1XthLDh5TMIAANmZKGeAkI523.jpg "title=" 36020150907202632298.jpg "alt=" wkiol1xthldh5tmiaanmzkgeaki523.jpg "/>650) this.width=650;" src= "http:// S3.51cto.com/wyfs02/m01/72/cc/wkiol1xthm3ix6jvaai83rumddw945.jpg "title=" 36020150907202703386.jpg "alt=" Wkiol1xthm3ix6jvaai83rumddw945.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/CC/wKioL1Xtg9rTK88DAANDjxXWsIQ572.jpg "title=" 36020150907202256164.jpg "alt=" Wkiol1xtg9rtk88daandjxxwsiq572.jpg "/>
AT command
To host a job that runs in the future time:
Support for using job queues: default to a queue
Ctrl+d----Submit a job
at [option]....time
Time
(1) Absolute time
hh:mm
Mmddyy,mm/dd/yy,dd. Mm. Yy,yy-mm-dd
Tomorrow
(2) Relative time
now+ #UNIT
Minute,hour,day,week
(3) Blur time
Midnight
Noon
Teatime
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/CF/wKiom1Xthc3Qknb7AADTzmf5Sds257.jpg "title=" 36020150907204035309.jpg "alt=" Wkiom1xthc3qknb7aadtzmf5sds257.jpg "/>
Common options:
-Q queue:at Job queue:
-f/path/from/somefiles: Jobs that are read from the specified file
-L: View the list of currently pending jobs in the job queue, equivalent to the ATQ command
-C At_job_num: Look at the contents of the Run job
-D: Delete the specified job ATRM
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/CF/wKiom1XtisbwX_z_AACW7iDt7Q0473.jpg "title=" 36020150907210129925.jpg "alt=" Wkiom1xtisbwx_z_aacw7idt7q0473.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/CC/wKioL1Xtjo6BV4PvAAAgiwJwqtA215.jpg "title=" 36020150907210839395.jpg "alt=" Wkiol1xtjo6bv4pvaaagiwjwqta215.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/CC/wKioL1Xtj9TRsHMBAAEO75pJpBc116.jpg "title=" 36020150907211401968.jpg "alt=" wkiol1xtj9trshmbaaeo75pjpbc116.jpg "/>650) this.width=650;" src= "http:// S3.51cto.com/wyfs02/m00/72/cc/wkiol1xtkndhaplyaabv5shcpr8729.jpg "title=" 36020150907211759487.jpg "alt=" Wkiol1xtkndhaplyaabv5shcpr8729.jpg "/>
Crontab Recurring Mission Plan
Daemon: Crond
There are two types of recurring tasks:
(1) The System Crond the task, does not have the default running user identity, so to specify the additional runner;
/etc/crontab------VIM Command modification
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/D1/wKiom1XtorSiUDZxAAGVlTb2cS0270.jpg "title=" 36020150907224350153.jpg "alt=" Wkiom1xtorsiudzxaagvltb2cs0270.jpg "/>
7 fields
There are 5 fields: the point of time
User-name: Run a task as a user
command to be executed: running tasks
(2) User Crond task, there is a user to submit, the default is to run as the submitter, so there is no need to specify the additional runner
/var/spool/cron/username
VIM command: Not recommended
crontab command, suggest
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/D1/wKiom1XtoRvSOo0DAAFKbcbLRSE497.jpg "title=" 36020150907223653132.jpg "width=" height= "155" border= "0" hspace= "0" vspace= "0" style= "width:512px;height:155px;" alt= "Wkiom1xtorvsoo0daafkbcblrse497.jpg"/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/D1/wKiom1XtorSiUDZxAAGVlTb2cS0270.jpg "title=" 36020150907224350153.jpg "alt=" Wkiom1xtorsiudzxaagvltb2cs0270.jpg "/>
6 fields
There are 5 fields: the point of time
Point in time:
Minutes: 0-59
Hours: 0-23
Day: 1-31
Month: 1-12
Weeks: 0-7 (0 or 7 for Sunday)
Note: Included with, not recommended for a few months and the number of weeks in conjunction with
command to be executed: running tasks
For example:
6 * * * *
Description
*: Each time within the valid value range of the time point
-: A specific continuous range: 3-7
,: A discrete point in time 3,5,7
/#: How many times in the effective time range to specify the frequency 1-30/4,*/4
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/CE/wKioL1Xtr4TiMbkwAABYkSJKG_4975.jpg "title=" 36020150907232910072.jpg "alt=" Wkiol1xtr4timbkwaabyksjkg_4975.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/CE/wKioL1XtsIfizG_hAACqASYLomY233.jpg "title=" 36020150907233333311.jpg "alt=" Wkiol1xtsifizg_haacqasylomy233.jpg "/>
crontab command:
crontab [-u user] [-l|-r |-e]
-U User: Manages the crond of the target user, only root has permission, the default management of their own.
-l:list, List tasks
-r:remove, remove All Tasks
-e:edit, editor
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/CE/wKioL1XttCaxkibZAADrKcOCtxQ597.jpg "title=" 36020150907234903394.jpg "alt=" Wkiol1xttcaxkibzaadrkcoctxq597.jpg "/>
Supplemental Tool: Anacron-----Check tasks, if not executed, execute immediately.
Attention:
(1) If you do not want to accept the task execution result notification message;
COMMAND >/dev/null
(2) for crontab files,% has a special utility. If% is present in the command, remember to escape, or use single quotation marks to apply
(3) Crontab's path variable is not identical to the user's variable, it is recommended to use absolute path in crontab. The absolute path must also be used in the script.
/root/bin/a.sh
Practice:
1, 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/M01/72/CF/wKioL1Xtw-HjccFnAAAr50QdX9w547.jpg "title=" 36020150908005601657.jpg "alt=" Wkiol1xtw-hjccfnaaar50qdx9w547.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/D3/wKiom1XtwIHy2dRpAABaXC_ZGrY375.jpg "title=" 36020150908005101772.jpg "alt=" Wkiom1xtwihy2drpaabaxc_zgry375.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/CF/wKioL1Xt1zzhR6_hAAA_DxkuzDU535.jpg "title=" 36020150908021842309.jpg "alt=" Wkiol1xt1zzhr6_haaa_dxkuzdu535.jpg "/>
2, 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/M01/72/CF/wKioL1XtzBPxqp84AAAuGGmLFMo630.jpg "title=" 36020150908013111276.jpg "alt=" Wkiol1xtzbpxqp84aaauggmlfmo630.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/D3/wKiom1Xt1PPzLspkAABT1VbWOa0293.jpg "title=" 36020150908021813197.jpg "alt=" Wkiom1xt1ppzlspkaabt1vbwoa0293.jpg "/>
3, 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/D3/wKiom1Xtz1qiKb2uAAAw2bU75_s070.jpg "title=" 36020150908015417669.jpg "alt=" Wkiom1xtz1qikb2uaaaw2bu75_s070.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/CF/wKioL1Xt1q2jgl3wAACU4icLIFc662.jpg "title=" 36020150908021623261.jpg "alt=" Wkiol1xt1q2jgl3waacu4iclifc662.jpg "/>
Linux Task Scheduler