Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
主機負載太高造成死當的解法 – unethost無限空間虛擬主機 技術分享部落格

主機負載太高造成死當的解法

#!/bin/sh
# Bash script that checks apache:
# – If server load is higher than 20, kill web server
#
# Script to be ran as cronjob (every 5 minutes)
# */2 * * * * /path/to/httpd_check >> /path/to/httpd_check.log

echo “httpd checker running at ” `date`
check=`uptime | sed ‘s/\./ /g’ | awk ‘{print $10}’`
if [ $check -gt 20 ]
then
echo “Server load too high ($check), kill all the following program: httpd, php, mysqld”
killall httpd
killall php
killall mysqld
else
echo “Server load OK ($check)”
fi

echo “—————-“