There are two different operations described here: 1. Monitor the Linux server load and memory usage, such as MySQl, php-fpm, when the load or memory usage reaches the set value. , will automatically restart the process to avoid downtime: according to the proportion of remaining memory response 2, VPS server automatically restart according to CPU load and memory usage: according to the remaining actual memory number to talk about the file inside the compressed package, respectively, auto_reboot.sh And check_reboot.sh, corresponding to the above 1, 2 and 2 points. After downloading the compressed package, first modify the parameters inside to match the configuration of your own server. For details, see the following settings: auto_reboot.sh: # Set the maximum memory usage percentage PID_MEM_MAX=”85″ # Set the maximum system load SYS_LOAD_MAX= ”3″ # Set the service name to be monitored NAME_LIST=”php-fpm mysql”
2. The place where check_reboot.sh is set: # Set the minimum remaining memory, generally at least 50M is available (unit megabytes) FREE_MEM_MIN=”50″ # Set the maximum system load SYS_LOAD_MAX=”3″ # Set the minimum remaining memory of the restart service (in megabytes) RESTART_FREE_MEM_MIN=”500″ # Set the service name to be monitored NAME_LIST=”httpd mysqld” The red place needs to be modified according to the configuration of the server hardware. After the modification, upload the two *.sh files to the path that Root can access on the server, add the scheduled task, and set the check every minute. crontab -e * * * * * /bin/bash/root/auto_reboot.sh Note the code above Each * is followed by the Tab key. The trailing path is the path of the file you just uploaded. Be sure to access the path that root can access. Note that the location of the file should be correct. Make sure that bc is already installed on your Linux system, otherwise an error will occur. To see if bc is installed, you can use the command: bc -v If not installed, centos can install it with yum -y install bc
You can use the following command to test whether the script works normally (if it is normal, it should not return) Anything) sh /bin/bash/root/auto_reboot.sh If you get a syntax error near unexpected token `do, please do Baidu or Google. good luck.
server is 2003 system, usually used well, but recently jumped out! IIS Worker Process encountered a
For anyone in any field, it is the first to start with a novice, and constantly improve their skills
In the LAN working environment, the network administrator often manages the serve
Using other peoples hard disk to establish FTPFTP is a service that network admini
Linux can not resolve the domain name solution
About the five major misunderstandings of blade servers
Entry-level rack service assembly Baotong DIY service
Seven Questions and Answers for Enterprise Firewalls
Upgrade the server Have you considered these ten things?
Linux streaming media Helix Server detailed installation and configuration
Lack of .net2.0 and vc9 causes some software to be installed.
Website Technology-SERV-U FTP Little-known Skills
Implementing RAID function with software under Linux (2)
Experience: Clearly reflects the effect of server integration
Microsoft: Not all pirated XP users can update SP2
Centos crack password and run level
Two strokes to easily recover the wrong Ghost hard drive
Windows XP IE Add-on Management
Win10 system memory usage is getting higher and higher solution
Windows 8.1 desktop properties detailed
Work is too busy to know what to do? Win7 notes easy to take care of