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
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.
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.
#4. The crond service providescrontab commandSet scheduled tasks. The crontab command can use the -h command to view some parameter information
5,
The syntax of crontab scheduled tasks is
Minutes Hours Day Months Weekdays Command0-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
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.
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!