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
Data display has always been a demand that all wa...
1. Block-level element: refers to the ability to e...
This article shares the specific code for impleme...
This article describes how to build a Nexus priva...
Msyql database installation, for your reference, ...
Recent projects involve the creation of a lot of ...
When we write code, we often need to know the dif...
Preface Tomcat is an excellent Java container, bu...
Environmental requirements: IP hostname 192.168.1...
1. Problem Sometimes when we log in to Mysql and ...
Generally speaking, after the container is starte...
How to delete environment variables in Linux? Use...
Query the MySQL source first docker search mysql ...
Next, I will create two tables and execute a seri...
This article briefly describes how to use Docker ...