I have searched various major websites and tested the operation of related scheduled tasks to facilitate everyone's reference and operation. 1. Introduction to cron The crontab command we often use is the abbreviation of cron table. It is the configuration file of cron, and it can also be called job list. We can find the relevant configuration files in the following folders. 1.1. Cron related directories
1.2. Common commands of crontab
1.3. Writing specifications 1. The parameters of each position are as shown below, and there are also notes for details. Remark: 1) * means that any time (minute, hour, day, month, week) will be executed 2) - Indicates a time range, such as 5-7 o'clock 3) , represents the time interval, such as 6,0,4 represents Saturday, Sunday, and Thursday. 4) /1 means every n time units, such as */10 every 10 minutes 2. Set up scheduled tasks 2.1. Globally set up scheduled tasks crontab --- when the task is to link, curl or write files (1) Execute the command crontab -e (2) Write a scheduled task If the scheduled task is to link */1 * * * * /usr/local/curl (your own curl path) www.baidu.com >/dev/null 2>$1 If you need to write the content to the file */1 * * * * echo "hello" >> abc.log I would also like to share a few points
(3) Save scheduled tasks
2.2. .sh method implementation (1) Create a Shell Script
chmod -R 777 you create the file name (2) Write the Shell script into the scheduled task Write the corresponding shell file into the scheduled task */1 * * * * The absolute path of your .sh file>/dev/null 2>$1 Write the corresponding shell file to the log when executing the scheduled task */1 * * * * The absolute path of your .sh file >> a.log >/dev/null 2>$1 (3) Restart crond service crond restart (4) Check whether it is written into the project crontab -l Thank you for watching, if you have any questions please leave a message in the comment section. Summarize This is the end of this article about some related operations of Linux scheduled tasks. For more related Linux scheduled tasks, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: JS realizes the automatic playback effect of pictures
>>: Sample code for implementing PC resolution adaptation in Vue
The reason is that all files are encoded in utf8. ...
In this project, the Docker container is used to ...
Web front-end optimization best practices: conten...
Preface: The storage engine is the core of the da...
Table of contents 1. Parent-child component commu...
<br />Original text: http://andymao.com/andy...
MySQL master-slave replication allows data from o...
1. MySQL self-connection MySQL sometimes needs to...
When installing Docker on Windows 10, after selec...
The installation of MySQL 8.0.12 took two days an...
Table of contents Native JS How to send a get req...
Table of contents First, let's briefly introd...
Debug branch During the normal development of a p...
Hyperlink Hyperlinks are the most frequently used ...
This article describes how to use Docker's mu...