Linux Task management

Source: Internet
Author: User

There are two types of task management under Linux, one-time and periodic. One-time is at and batch, and the cycle is divided into system tasks and user tasks.

Disposable tasks:

1. Command format: at [option] Time

2. Option option:-l Specify queue-F to specify file-L view Queue-D Delete queue

3, Time:teatime noon midnight Teatime tomorrow Now

4, the execution method: with at command has the interactive way and the batch processing two kinds of ways. Interactive is when the user enters at [option] time and waits for the user to continue entering the command to execute at the cursor, then submits the task with Ctrl+d. The batch will use-F, the user will execute the command to write to the file, and then use-F to specify the file.

5. Execution result: The result of execution will be sent to the user in the likeness of mail.

6, and Batch difference: Batch can not specify the time, but choose the user system idle time to execute.

Recurring tasks:

Principle of execution: Both the system task and the user task are performed by the daemon Crond reading the user-defined file. When the system task file is/etc/crontab, the user task file is/var/spool/cron/username.

System tasks:

Task definition Format: Each row defines a task, formatted as * * * user command

Time Format: *-. /is a symbol that can be used. * represents all the desirable values for that bit,-represents a continuous value in this interval. Represents the discrete value of this interval,/#表示在某区间每隔 # Perform a task

User tasks:

Command: Using the crontab command, you can use the parameters of the-e call editor in editor to edit,-u Specify the user,-L to view the task,-R to delete the crontab file.

Example:

How to implement a second-level task: * * * * * * for i in {1...4};d o/bin/echo "Hello"; Sleep 1;done

Not divisible how to resolve: available at execution. Write in file while True;do Ls/sleep 10;done

In addition to Crontab, there is also a command to Supplement crontab, Anacron. It is used to detect if a task in Crontab has missed the last time it was executed, and if so, to have the task execute at some time after booting.

        

Linux Task management

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.