Routine work scheduling at, Cron, Anacron

Source: Internet
Author: User

routine Work : The System a point in time is automatically 's work

    • Execute only once to end dispatch: At, service is ATD

    • Cyclic execution of the work schedule: crontab, service for Crond

Common routine work

    • Journal rotation (log rotate)

    • Logging Analysis (log watch)

    • Update Database

    • Delete temporary files (tmpwatch)

    • Network-related service checks

At: Job scheduling performed once

1: Process of generating work

    • The AT command generates the work to run

    • Writes work as text to the /var/spool/at directory

    • Wait for ATD service to execute

2:at Work Scheduling rules

    • /etc/at.allow: Users written in this file can use the at

    • /etc/at.deny: does not exist/etc/at.allow when written in this file cannot be used at

    • When none of the two files are available, only root can use an at

3: Use

    • Start Service: ATD

    • At [-M to notify the completed work by email] [-c list work commands]

    • ATQ viewing work, atrm [job ' numbr Delete work]

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/CC/wKioL1WI4i-zsaGmAAEzPR3KpOs488.jpg "title=" 2015-06-22_10-53-55.png "alt=" Wkiol1wi4i-zsagmaaezpr3kpos488.jpg "/>

    • Batch: Using the same method as at, background tasks are performed only when the CPU load is less than 0.8

Cron: cyclic execution of routine work scheduling

1: Workflow

    • crontab command to generate the work to run

    • Writes work as text to the /var/spool/cron directory

    • Cron reads/var/spool/cron once per minute

    • Cron performs every job that is logged in the /var/log/cron log file (at No)

    • /etc/cron.allow and/etc/cron.deny (same as at)

2: Use

crontab [-e edit content] [-l view Content] [-R Delete all work] [-u Specify user edit]

Enter a text interface (actually executes the/usr/bin/crontab file)

    • Format: time-sharing weekly command

    • Special character meaning

* Any time

, with: * 3,4 * * * command three points and four points

-To: * 3-5 * * * Command three to five

/n per: */3 * * * * command every three minutes

    • Cases

*/5 * * * */home/boxin/test.sh //Every 5 minutes Execute command

1 1 * Mail my //Every January 1 23:59 send an e-mail to my

3: System configuration file:/etc/crontab

    • Cron This service reads /etc/crontab and/var/spool/cron data once every minute.

    • /etc/crontab:Root can edit this file directly to write work

[Email protected] ~]# Cat/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root//email to root when there is an error
home=/
# for details see Mans 4 Crontabs
# 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

4:anacron can wake up work tasks during downtime

is not a separate service, is a supplement to the crontab, during the shutdown period, unable to perform routine work, through the Anacron tool, you can detect during the shutdown during the outage need to do crontab tasks, and do

    • According to the current time and the last run time stamp comparison, the difference time is greater than or equal to the work cycle, will carry on the Acrontab work schedule


This article is from the "Call Me boxin" blog, so be sure to keep this source http://boxinknown.blog.51cto.com/10435935/1664419

Routine work scheduling at, Cron, Anacron

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.