Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Scheduled tasks under linux can be divided into several categories

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the scheduled tasks under linux can be divided into several categories, the article is very detailed, has a certain reference value, interested friends must read it!

Scheduled tasks are a very good function provided to us by the operating system, and we often use scheduled tasks to deal with some things. such as regularly backing up website data every day, executing the data statistics program every month, monitoring the operation of the server (sending a message to the administrator when an error occurs), and so on.

Scheduled tasks under linux are divided into two categories: scheduled tasks that are executed only once, and scheduled tasks that are executed periodically. Today, let's take a look at scheduled tasks that are executed only once, and scheduled tasks that are executed periodically will be described in the next article.

Atd service

We only perform the planned task once, and we do it through the at command. To execute the at command, we need to start the atd service first. The commands to view the health status of the atd service and enable the atd service are as follows:

# check atd service status # systemctl status atd # enable atd service # systemctl start atd

At rights management

When you use at to generate a new task, the task is placed in the / var/spool/at directory as a text file.

# ll / var/spool/attotal 8 RWX-1 root root 2890 Nov 7 16:30 a0000201981b23 date > > / root/at.txtat > date > > / root/at.txtat > job 4 at Sat Nov 7 17:01:00 2020

View scheduled tasks

Use the-l option to view scheduled tasks, and use the-c option if you want to see specific commands. In addition, you can use the atq command to view it.

# at-L6 Sat Nov 7 17:13:00 2020 a root3 Wed Nov 11 17:00:00 2020 a root# atq6 Sat Nov 7 17:13:00 2020 a root3 Wed Nov 11 17:00:00 2020 a root

Remove scheduled tasks

Scheduled tasks that have not been performed can be deleted through at-d or atrm.

# at-d atrm 6

Another benefit of using at to generate scheduled tasks is that offline management can be done.

The above are the scheduled tasks under linux can be divided into several categories of all the content, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report