20 lines
405 B
Bash
20 lines
405 B
Bash
#!/bin/bash
|
|
|
|
wait_count=0;
|
|
est_count=0;
|
|
|
|
while [ 1 ]
|
|
do
|
|
new=`netstat -an |grep 3306 |grep TIME_WAIT |wc -l`
|
|
new2=`netstat -an |grep 3306 |grep ESTABLISHED |wc -l`
|
|
if [ $wait_count != $new ]; then
|
|
echo Number of connections waiting = $new
|
|
wait_count=$new
|
|
fi
|
|
if [ $est_count != $new2 ]; then
|
|
echo Number of connections established = $new2
|
|
est_count=$new2
|
|
fi
|
|
sleep 1
|
|
|
|
done |