Scheduled task management in linux

Source: Internet
Author: User
There are two types of scheduled tasks: one is to stop executing after one side, and the other is to periodically execute scheduled tasks divided into: System scheduled tasks, user-defined scheduled tasks. Scheduled Tasks can be created in two ways: one is not executed after one side is executed, and the other is periodically executed.
Scheduled tasks include scheduled tasks of the system and custom scheduled tasks.
Scheduled Tasks mean creating and managing automatically executed commands and tasks within a certain period of time.

1: the commands for executing a scheduled task for a short time are: at command to manage the atd process
Usage: at task_time = now + 4 hours YYYY/MM/HH
Atq queries which tasks exist. atrm id: deletes a scheduled task.
The batch command is exactly the same as the at command, but the batch command executes the plan when the system is not busy.
Configuration File:
/Etc/at. allow/etc/at. deny these two files control the use of at scheduled tasks by specific users. for details, refer to the help documentation.
/Etc/spool/at the data in this configuration file is the storage location of the task.

2: run the "crontab" command to manage cron processes.
The crontab command manages two types of scheduled tasks: system and user.
The scheduled tasks of the system are stored under/etc/cron. d/. if the virus is generated as a scheduled task file, the system will be in crisis.
The format of a crontab scheduled task is described in the/etc/crontab file.
The system configuration must be strictly in accordance with the format, and user names are not required for custom scheduled tasks.
A. procedure for creating a system scheduled task:
1: touch/etc/cron. d/myplain
2: vi/etc/cron. d/myplain
0 5-17 */3 * Sun root/cron. sh ~ Execute the script as root/cron. sh.
*/5 4 *** user/bin/fsck execute the command fsck every 5 minutes at every day
B. create a user scheduled task:
The crontab-e-u root-e option creates a root user task for edit.
Crontab-r-u hu-r: remove to delete the hu user's task
Crontab-l-u hu-l: list to view scheduled tasks
User-defined scheduled task data is stored under/var/spool/cron /.
Cron configuration files include/etc/crontab/etc/cron. d /*
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.