LINUX Task Scheduler Application Summary

Source: Internet
Author: User

Task Scheduler Related programs:

Perform a task at a time in the future: at, Batch

Perform a task periodically: Crontab \ \ Operations

Execution Results view: Mail

Mail e-mail Service:

Default execution result write:/var/spool/mail/username

Smtp:simple Mail Transmission protocol

/var/spool/mail/username

Pop3:post Office Protocol
Imap4:internet Mail Access Protocol1 '

Mua:mail command

Mail command:

Mail: Enter the interactive email interface;

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image001[6] "border=" 0 "alt=" clip_image001[6] "src=" http://s3.51cto.com/wyfs02/M00/72 /de/wkiom1xu1cvbzpliaaeuqe4mude426.jpg "" 444 "height=" 175 "/>
Mail-s ' SUBJECT ' [email protected]

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image002[4] "border=" 0 "alt=" clip_image002[4] "src=" http://s3.51cto.com/wyfs02/M01/72 /de/wkiom1xu1cvdy3nvaabgd2ds7ay587.jpg "" 617 "height="/>

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image003[4] "border=" 0 "alt=" clip_image003[4] "src=" http://s3.51cto.com/wyfs02/M02/72 /de/wkiom1xu1c3beqiuaal0lnsigoy177.jpg "" 617 "height=" 358 "/>

Mail-s ' SUBJECT ' [email protected] </path/from/somefile

COMMAND | Mail-s ' SUBJECT ' [email protected]

At

To host a job that runs in the future time:

Support for using job queues:

The default is a queue;

Ctrl+d Saving Tasks

At [option] ... Time

Time:

(1) Absolute time

HH:MM,

Mmdd[cc]yy,mm/dd/[cc]yy, dd.mm.[cc]yy or [cc]yy-mm-dd

Tomorrow

(2) Relative time

now+ #UNIT

Minute,hour, day, week

(3) Blur time

Midnight Midnight

Noon PM

Teatime Afternoon Tea Time

Common options:

-Q queue:at Job queue;

-f/path/from/somefile: Reads the job to be run from the specified file;

-L: View a list of such running jobs in the job queue; equivalent to using the ATQ command;

-C At_job_num: Look at the contents of the running job;

-D: Delete the specified job; equivalent to ATRM

Batch

The system chooses to run the specified task when the resource is more idle;

crontab : Recurring Task Schedule

Daemon: Crond

There are two types of recurring tasks:

(1) System cron task; There is no default running user identity, so you need to specify the additional runner;

/etc/crontab

Vim command

#Example of Job Definition:

#.----------------Minute (0-59)

#|.-------------Hour (0-23)

#| |.----------Day of Month (1-31)

#| | |.-------month (1-12) orjan,feb,mar,apr ...

#| | | |.----DAY of Week (0-6) (sunday=0 or 7) Orsun,mon,tue,wed,thu,fri,sat

#| | | | |

#* * * * * user-name command to be executed

7 fields:

Top 5 fields: Point in time

User-name: Run with User-name

Commandto be executed: To run a task

(2) User Cron Task: Submitted by a user, 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: Recommended

#Example of Job Definition:

#.----------------Minute (0-59)

#|.-------------Hour (0-23)

#| |.----------Day of Month (1-31)

#| | |.-------month (1-12) orjan,feb,mar,apr ...

#| | | |.----DAY of Week (0-6) (sunday=0 or 7) Orsun,mon,tue,wed,thu,fri,sat

#| | | | |

#* * * * * command to be executed

5 Time points:

Minutes: valid value range 0-59;

Hours: 0-23

Day: 1-31

Month: 1-12

Weeks: 0-7

Note: The date of the month and the number of weeks, not recommended to use at the same time;

Time notation:

*: Each time point in the valid value range of the time point;

-: A specific continuous time range, 3-7

,: A discrete point in time, 3,5,7

/#: The amount of time in a valid time frame, for specifying the frequency;

1-30/4,*/4

5*/3 * * */bin/echo "howdy"

* * 1-5/bin/echo "Howdy"

crontab command:

Crontab[-u user] [-l |-r |-e]

-uuser: Instead of managing its own cron task, it is the cron task of the specified target user; only Root has permission to manage other users ' cron tasks; By default it manages its own;

-l:list, list the tasks;

-r:remove to remove all tasks;

-e:edit, edit, open a default editor for the current shell session to edit the cron task table;

Practice

Every Monday to Saturday 3:20 A.M., run the CP command to save the/etc/directory for archiving, the storage location is/BACKUPS/ETC-YYYY-MM-DD

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image004[5] "border=" 0 "alt=" clip_image004[5] "src=" http://s3.51cto.com/wyfs02/M02/72 /de/wkiom1xu1c7rv0xsaaa0y_ccnok221.jpg "447" height= "Max"/>

Every Sunday 2:30 A.M., run the CP command to back up the/etc/fstab file with a storage location of/BACKUP/FSTAB-YYYY-MM-DD-HH-MM-SS

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image005[19] "border=" 0 "alt=" clip_image005[19] "src=" http://s3.51cto.com/wyfs02/M00/ 72/de/wkiom1xu1c_xnhwgaaa7strw24q651.jpg "" 557 "height="/>

Every night 12 o'clock, get all lines in the/proc/meminfo file that begin with S or M, append to the/statistics/meminfo.txt file, and precede the daily message with a similar =============== separator line;

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image006[8] "border=" 0 "alt=" clip_image006[8] "src=" http://s3.51cto.com/wyfs02/M02/72 /db/wkiol1xu1_vtcqrnaaa4yjenjjy481.jpg "" 617 "height="/>

LINUX Task Scheduler Application Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.