AppVZ.com
Phone Tech support
+84.904982000
Email
Language: Vietnamese English Germany France

Auto restart Apache when high-load

1: Create check file:

cd /usr/local/
mkdir auto
cd auto
nano -w restart.sh

Paste script:

#!/bin/sh
check=`cat /proc/loadavg | sed 's/\./ /' | awk '{print $1}'`

if [ $check -gt 5 ]
//recommend: field 5 for 512MB RAM, 10 for 1GB RAM, 20 for 2GB RAM
then
/etc/init.d/httpd restart
fi

Save and chmod script to 755:

chmod 755 restart.sh

2: Create cron file:

cd ~
cd /etc/cron.d
nano -w auto_restart

Paste script:

*/5 * * * * root /usr/local/auto/restart.sh >/dev/null 2>&1

Save cron file and finish.



Was this answer helpful?

Also Read
Jailed Shell SSH (Views: 2554)
Chmod cho PhpBB3 (Views: 2279)
Chmod cho Wordpress (Views: 3620)

Quick Navigation

Client Login

Email

Password

Remember Me

Search


Follow Us on Twitter

Online Payments Accepted

Payments

Copyright © 2009 - 2022 by AppVZ.com
Networks System - Term of Services