Install crontab CentOS 7 comes with it, I didn't install it manually Start/Stop service crond start // Start the service service crond stop // Shut down the service service crond restart // Restart the service service crond reload // Reload the configuration Check whether the crontab service is set to start at boot systemctl list-unit-files | grep enable | grep crond Add crontab to start automatically at boot chkconfig crond on // or systemctl enable crond.service View crontab status service crond status // View crontab service status Writing scheduled task command format min hour day month dayofweek command Time-sharing day, month, and day of week command min: the minute of each hour at which the task is executed; the value range is 0-59 hour: the hour of the day to execute the task; the value range is 0-23 day: the day of the month to execute the task; the value range is 1-31 month: the month of the year when the task is executed; the value range is 1-12 dayofweek: the day of the week to execute the task; the value range is 0-6, 0 means weekend command: specifies the command to be executed There are two ways to edit the command: Enter in the command line: *: indicates any time; for example, * in the hour position indicates every hour n: indicates a specific time; for example, the hour digit 5 means 5 o'clock n,m: Indicates several specific times; for example, the hour digits 1,10 represent 1 o'clock and 10 o'clock n-m: represents a time period; for example, the hour digits 1-5 represent 1 to 5 o'clock. /n: Indicates how many time units are used to execute the command; for example, hour position /1 means that the command is executed every 1 hour, which can also be written as 1-23/1 Little Chestnut * 1 * * * ~/clear_cache.sh: Execute the script every 1 minute from 1:00 to 1:590 * * * * ~/clear_cache.sh: Execute the script at 0 minute of every hour*/10 * * * * ~/clear_cache.sh: Execute the script every 10 minutes Script to clean up system cache Code: vim ~/clear_cache_logs.txt sudo sysctl -w vm.drop_caches=3 sudo sysctl -w vm.drop_caches=1 echo `date -R` >> ~/clear_cache_logs.txt free -lh >> ~/clear_cache_logs.txt Clean the memory Summarize The above is a detailed introduction to the installation and use of Linux crontabs scheduled tasks. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Three methods of inheritance in JavaScript
>>: How to create a view on multiple tables in MySQL
This article uses an example to illustrate the us...
1. Usage of instanceof instanceof operator is use...
Most navigation bars are arranged horizontally as...
Table of contents 1. some 2. every 3. find 1. som...
What is HTTP? When we want to browse a website, w...
Table of contents 1. Problem 2. Solution 1. Decla...
In the front-end layout of the form, we often nee...
<br />The countless information on the Inter...
Preface This article mainly introduces the releva...
01. Command Overview basename - strip directories...
Table of contents Environment Setup Overview 1.Wh...
Introduction Part 1: Written at the beginning One...
I used js to create a package for converting Chin...
The equal-width layout described in this article ...
Recently, the project switched the environment an...