Linux: Routine work

Source: Internet
Author: User

What is routine work?

In fact, for routine work, it is necessary to work periodically in the current environment.


Under Linux, there are 2 types of routine work:


One is sudden, and after that, there's no such thing.

At:at is a command that can handle the end of a schedule only once, but the service must be ATD to execute at.

In some Linux versions this service is not turned on by default, so we need to open this service.


The other is routine, that is, every certain period of time to do things:

Crontab:crontab the work of this command lock setting will be cycled all the way down. The time that can be cycled is minutes. Hours. Weekly. monthly or yearly. Crontab In addition to the use of command execution, you can also edit/etc/crontab to support,


Then we'll look at the usual routine work under Linux:


    1. Rotation of the log file (log rotate);

    2. Log file Analysis Logwatch tasks:

System software problems, hardware errors, and so on most of the information will be recorded in the log file, so Logwatch is the active analysis of log file information to the software/hardware error content monitoring.

3. New database of locate;

The establishment of 4.whatis database;

5.RPM The new software log file;

6. Delete temporary files;

7. Analytical behavior related to playing a service;


Here's a look at working with Linux:

ATD Start-up and at operation mode;

Open at:

Under Root user rights:

/ETC/INIT.D/ATD restart


Use:

at [-MLDV] Time

-m:at work is completed, even if no output information, in the form of an email notification that the user's work has been completed

-L: Lists all the at jobs on the system

-D: Cancel a job in the schedule

-V: You can list the at worksheet with a more obvious time format

-C: You can list the actual command contents of the work that followed


TIME:HH:MM 04:00 hh:mm yyyy-mm-dd 04:00 2009-03-17

Hh:mm[am|pm][month][date] 04pm March 17

hh:mm[am|pm]+ Numer[minutex|hours|days|weeks] Now + 5 minutes 04pm + 3 days


ATQ show current at list, ATRM [Jobnumber], delete at item


Routine work schedule for loop execution:

User's settings:

/etc/cron.allow can be used when added, not available

/etc/cron.deny writes are not available and can not be used.


To add a recurring routine work:

crontab [-u username] [-l|-e |-r]

-u:root to do this task, but also to help other users new/delete crontab work schedule;

-E: Edit crontab work content:

-L: Check the contents of crontab

-R: Delete all, delete the words please-e edit


Edit syntax:

Photo by: Brother Bird's Linux private cuisine:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/E0/wKioL1cwrZDxd8mSAAGa131ozYw955.jpg "title=" Fullsizerender (1). jpg "alt=" wkiol1cwrzdxd8msaaga131ozyw955.jpg "/>

Then let's try it out:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E0/wKioL1cwrjCCxMY7AAAneFQYKj4341.png "title=" QQ picture 20160509224555.png "alt=" Wkiol1cwrjccxmy7aaanefqykj4341.png "/>

*/5 * * * * echo Hello >/dev/pts/0

Sun and Moon Week #分 [========== command string =====]


is to print hello to the current terminal every 5 minutes.

The TTY command queries the current terminal path.


This article is from the "egg-left" blog, please be sure to keep this source http://memory73.blog.51cto.com/10530560/1771639

Linux: Routine work

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.