as I'm experiencing some unknown problem, which causes, that from time to time, the server just freezes, I need to fix this :
1) during the day or night, the server is running fine. Then, for some reason the MySQL databaze is unable to handle all the queries (I did not identified yet WHY), and causes high load, memory is consumed and the server starts to swap, killing processes and usually get into some kind of unstable position.
Until I will be able to fix this problem, I'd like to have a cron job, which will every minute check for the average load of the machine, and if the load is higher than let say 5.00, it issues this command : /etc/init.d/apache2 stop, waits for 10 minutes, and makes /etc/init.d/apache2 start
Can anybody help me, how to do this script ?
Thank you !