17th Day-linux System Timing Task Crontab Introductory explanation

Source: Internet
Author: User

First understand the difference between the following procedures and processes:

Program Concept:
A program is a pre-programmed work execution plan to solve a information processing task, which is a sequence of basic instructions that a CPU can perform, each of which specifies what the computer does (such as add, subtract, multiply, divide, judge, etc.) and the relevant data required by the operation. For example, reading a number from memory to an operator is an instruction that reads a number from memory and sums it up with the number of the arithmetic device.
Simply put: We use the command is the program, QQ program, listen to the song MP3 software, Linux system is also a program.
Basic features: A bunch of code, a file, a command, the program is static, put on the computer has not been run.

Process concept:

The so-called process is now the system is executing the program, each time you enter a command, the shell will also start a process in time.
Simply put, the program that runs the system is the process in which the process is placed in memory.
When each process starts, the system assigns a unique number to each process, which is called the process ID referred to as the PID process number.
Each process can exist in two ways, a foreground and a background.
General system network services are in the background, and will be resident in the system, until the shutdown or active kill when the end, such as remote Connection service sshd.

Linux timed Task Service Crond (crontab) service
1. What is Crond?
Crond is a service or software that is used on a Linux system to perform regular commands or to specify program tasks.
Normally, when we install the system, Crond will be there by default.
When we optimize the boot service, the first one is Crond.
The Crond service default (per minute) checks the system for scheduled tasks that need to be performed, and if so, performs this scheduled task according to predefined rules.

Second-level tasks:
1, Crond self-powerless can be achieved through the method. http://blog.csdn.net/shootyou/article/details/6918538
2, write your own daemon Shell loop.
3, quartz can also be achieved.

2. Why do I need a scheduled task?
Server: The service is a basic feature of the website.
Important data: The data on the server is generally 1 days minimum, sometimes once per minute, or in real-time backup.
Midnight 1 Backup: We climb up every day to back up and then go to sleep, assuming a backup lasts 5 hours.
Timed tasks are generated, and scheduled tasks can be implemented to help us automatically back up data.

3, Linux scheduled task classification:
1, at is suitable for the execution of the task of the end of the dispatch. Sudden task. Dependent service ATD.
2, Anacron suitable for non-7x24 hours to boot the server, boot execution, detection of downtime during the task is not performed, after the boot once executed once.
3, Crond,crond service by default (per minute), the system will check whether there is a need to perform scheduled tasks, if any, will be based on predefined rules to perform this scheduled task. *****
Tip: We say Crond is a timed task daemon, and crontab is the command that the user uses to set the scheduled task rules.

4. Instruction option description with table

Parameters

meaning

Specify example

-L

View crontab file contents, hint:l can be understood as list abbreviation

Crontab-l

-E

crontab file contents, hint: < Span style= "font-size:medium;" >e can be understood as edit abbreviation

crontab-e

-i

will be prompted to confirm the deletion of the contents of the file, rarely used

crontab-ri

-r

Delete file contents

crontab-r

-u

Specifies the user to use to perform tasks

crontab-u boy

Add:crontab {-l|-e} is actually a file that operates /var/spool/cron/ the current user

5. User rights and scheduled task files

File

Description

/etc/cron.deny

The users listed in this file are not allowed to use crontab command

/etc/cron.allow

The users listed in this file are allowed to use crontab command, which takes precedence over /etc/cron.deny

/var/spool/cron/

All user crontab profiles are stored in this directory by default, and the file name is named after the user name

6. crontab Format Description

17th Day-linux System Timing Task Crontab Introductory explanation

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.