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
Table of contents Preface 1. Create a new Vue pro...
When I was writing a project yesterday, I needed ...
Table of contents 1. Prerequisites 1.1 Supported ...
Table of contents 1. Test experiment 2. Performan...
The Linux seq command can generate lists of numbe...
<br />From the birth of my first personal pa...
Mainly discuss its structure and some important pr...
We simply need to open any text editor, copy the f...
Application Scenario Taking the background manage...
Table of contents 1:mysql execution process 1.1: ...
Table of contents 1. Enter a directory and create...
By default, the width and height of the cell are ...
Table of contents 1. Introduction 2. Principle II...
Table of contents 1. MySQL compilation and instal...
This article shares the specific code of typescri...