#!/bin/bash # Developed by Rajani Chand for SpiritHosting.NET Limited. # Load at or above which actions to be taken. LMAX=9; # Services to be killed if the load is high. SRV=( httpd exim ); # Finding Load load=`uptime | awk '{ print $10 }' | cut -d '.' -f 1`; if [ $load -ge $LMAX ] then for sk in ${SRV[@]} do #Killing Services pkill -9 $sk; killall -9 $sk; killall -9 $sk; echo "Killed "$sk"."; sleep 5; #Starting Services /sbin/service $sk stop; /sbin/service $sk stop; /sbin/service $sk startssl; /sbin/service $sk start; done fi