Linux Process Management (version 2) and linux Process Management

Source: Internet
Author: User

Linux Process Management (version 2) and linux Process Management
Scheduled Task 1. One-time scheduled task

At command # function: schedule one or more commands to run at a specified time (time ).

1. at Command Format and Parameters

At [-f file name] Time

At-d or atrm delete a task in the queue

[At generated files are stored in the/var/spool/at Directory]

View tasks in the queue at-l or atq

 

2. at specified time

Absolute timing method [recommended]

Valid time: midnight noon teatime

Hh: mm [today]

Hh: mm tomorrow

Hh: mm week

Hh: mm MM/DD/YY [recommended] [DD. MM. yy yymmdd]

 

Relative Timing Method

Now + n minutes

Now + n hours

Now + n days

 

[Example]

Specify to execute a command at this afternoon (assuming that the current time is, January 1, January 11, 2011)

At 5: 30 pm

At [today] # today can be omitted

At now + 3 hours

At now + 180 minutes

At 17:30 11.1.11

At 1/11/11

 

3. at example

I. Interaction Mode

At 9: 00

II. Using script files

1. Generate the at. script File

2. Use the at command

At-f at. script 1/11/11 or at <at. script

 

Appendix-at scheduled task files are saved in the/var/spool/at/directory.

Appendix-finger [+ username]: You can view scheduled tasks in the system.

If at has not been started, use:/etc/rc. d/init. d/atd start or service atd start to start it manually.

 

4. at execution result and configuration file

If/etc/. the allow file exists. Only users listed in this file can use the at command. If/etc/. if the allow file does not exist, check/etc/. whether the deny file exists. If/etc/at. deny exists, users listed in this file cannot use the at command. If neither file exists, only the super user can use the at command. If both files exist and are empty, all users can use the at command.

 

Batch Command [not commonly used]

1. Purpose: arrange one or more commands to run once when the system load is lighter (generally, the load is lighter, and the average load is below 0.8 ).

2. Use the same method as at. This command is generally used when the transaction is not very important.

Man explanation: batch executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified [specified] in the invocation [pray] of atd.

 

 

Ii. Periodic scheduled tasks

Crontab command

1. Purpose: generate the crontab file required by the cron process.

 

2. Format: crontab {-l |-r |-e}

-L display the current crontab content

-R: Delete the current crontab. [clear all, not recommended]

-E use the editor to edit the current crontab file.

 

3. crontab file format

[Minute hour day-of-month-of-year day-of-week commands]

[Commands/scripts for minutes, hours, days, months, and weeks]

 

Minute in the Minute hour [0 ~ 59]

Hour in a day in hour [0 ~ 23] [24-hour system]

Day-of-month in April January [1 ~ 31]

Month-of-year in which month [1 ~ 12]

Day-of-week which day of the week [0 ~ 6]

Command executed by commands

[Minute: */2: every two minutes]

[Hour: */1: every hour from]

 

[Add all the time values that you know, and fill in all the time values that you don't know *]

E. g

*/2 12-14*3-6, 9-12 1-5/bin/sh/root/cron. script>/dev/null 2>/root/cron. err

 

 

4. Notes for writing

I. Time values cannot be blank and must be filled in

II. Do not know/do not need to set the project value using the unified character * represents any time

III. Multiple values can be specified for each time field. Discontinuous values are separated by ",", and consecutive values are separated.

IV. The command should provide the absolute path

V. The user must have the permission to run the corresponding command or program

VI. Additional information, such as error information, should be stored for scheduled tasks

 

5. crontab configuration file/etc/crontab

# The last few lines of Linux in the old version define the task execution cycle of the system, such as hourly and daily.

 

6. cron configuration file

Purpose: restrict which users can use the crontab command, which has the same role as.

/Etc/cron. allow

/Etc/cron. deny

 

Appendix-after the crontab file is created, you can find it in the/var/spool/cron/directory and view the content in the file: more/var/spool/cron/root, the obtained information is like crontab-l.

 

Appendix-If crod is not started, start it manually:/etc/rc. d/init. d/crond start

Iii. Process Handling Methods

1. standalone runs independently, continuously resident in the system, consumes system resources, and listens to customer requests

2. The xinetd process is hosted, and the Internet super daemon process is used by xinetd to listen to customer requests and send them to relevant processes, instead of listening to the Service in person.

3. scheduled tasks such as atd and crond wake up from sleep every minute and check whether there are tasks to be executed.

 

Appendix-for the sake of security, the absolute path of the command must be written for scheduled tasks and Shell scripts!


Implementation of linux Process Management

Is the management system process or self-derived process about the system's process management principle?
If you want to manage your own processes, you can use the dispatch process, and then manage sub-processes through message queues, pipelines, and shared memory areas.

The process implementation principle of the system is complex.

What process management tools are provided in linux

Ps top kill cannot be found.

Related Article

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.