Auto restart Apache if the load is higher than x

HatUser

Newbie
Joined
Jan 11, 2014
Messages
4
Reaction score
0
Hi there,

My VPS get high load quite frequently and the best temporary option is a script that check the load periodically and if the load is bigger than 5 (for example), auto restart the apache server.

Can anyone help me?

Thank you!
 
I suggest you moving to Nginx, that solved ALL my problems last 2 years. Forget apache, is a history from the dark ages. More and more high volume websites are using nginx because of this reason.
 
restarting apache is probably the worst scenario you can pick. When apache is started it will get overloaded quickly due to the tons of new requests in short time. Best look how to optimize your site and make the things that cause the load less stressfull. Also consider the possibility to upgrade your VPS with more resources
 
Is a temporary solution during I re-make the website (this time more optimized).I found this script on internet:#!/bin/shcheck=`uptime | sed 's/\./ /' | awk '{print $10}'`if [ $check -gt 5 ]then/etc/init.d/apache2 restartfiI will love to talk with somebody that know to handle these things before install it on my VPS.Thank you!
 
Back
Top