Shell Scripting

Script to monitor the outgoing ssh connection on a linx machine

(100 is a private n/w so grepping it out)

max_ssh_conn=0
while true
do
ssh_conn=`netstat -an|grep -v 127|grep -v "100.1.1"|grep ":22"|grep ESTABLISHED|wc -l`
if [ $ssh_conn -gt $max_ssh_conn ]
then 
echo -n "connection increased to "
max_ssh_conn=$ssh_conn
echo $max_ssh_conn
else
echo "connection max seen is " $max_ssh_conn "and current connection level is at" $ssh_conn
fi
sleep 1
done

List only the filenames after using find command

find /opt -name '*.jar' -printf "%f\n"

Comments

Popular posts from this blog

vmWare - Vcenter Server Appliance 5.5 - embedded DB problem

Installing Pytest on Windows Platform