Home > System Tutorial > LINUX > How to set up daily scheduled tasks in Linux?

How to set up daily scheduled tasks in Linux?

WBOY
Release: 2024-01-01 22:35:48
forward
1339 people have browsed it

If you want to add a scheduled task in Linux, how to add it? Let’s take a look at the tutorial on adding scheduled tasks using the crond command.

1, crond is a command used by Linux to execute programs regularly . When the system installation is completed, this service will be started by default. crond will regularly check whether there is any work that needs to be performed every minute , you can view the running status of this service through status

linux怎么添加每天定时任务? linux添加定时任务的教程

2. This service can be stopped through the stop command. The automatic execution plan added after closing this service will no longer continue to execute.

linux怎么添加每天定时任务? linux添加定时任务的教程

3. This service can be restarted through the restart command. The configuration can be reloaded through reload. . Because redhat7 is used here, the systemctl command## is used.

linux怎么添加每天定时任务? linux添加定时任务的教程

#4. The crond service provides

crontab commandSet scheduled tasks. The crontab command can use the -h command to view some parameter information

linux怎么添加每天定时任务? linux添加定时任务的教程

5,

The syntax of crontab scheduled tasks is

Minutes Hours Day Months Weekdays Command

0-59 0-23 1-31 1-12 0-6 command (value range, 0 means Sunday, usually one line corresponds to one task)

Create a simple scheduled task as shown below,

where * represents all, / represents every

linux怎么添加每天定时任务? linux添加定时任务的教程

6. After execution, you can use -l to view the existing task plan.

If you want to view the execution results, you can view them directly in the result file specified in the task.

linux怎么添加每天定时任务? linux添加定时任务的教程

linux怎么添加每天定时任务? linux添加定时任务的教程7. There are

two ways to add scheduled tasks

, One is to add it through crontab -e as mentioned above, and the other way is to add it through Add through the /etc/crontab file.

The above is the detailed content of How to set up daily scheduled tasks in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template