Reboot server detecting open connections
#!/bin/bash
cd /home/mark/work/pop
svn up
echo 'updated to latest code. trying restart'
#find number of active connections that are established
number_of_conn=`netstat -apn 2>&1 | grep :80 | grep -i established | wc -l`
#echo $number_of_conn
trial=0
while [ $number_of_conn -ne 0 ]
do
trial=$((trial +1 ))
echo "$number_of_conn connections: trying again"
number_of_conn=`netstat -apn 2>&1 | grep :80 | grep -i established | wc -l`
done
/home/mark/bin/startstop
echo 'there were 0 connections. restarted'
echo "number of trials: $trial"
No comments:
Post a Comment