#!/bin/sh
numclients=`ps | grep "server" | grep -v "\-" | \
grep -v "grep" | wc -l | awk '{ print $1}'`
client=`ps | grep "server" | grep -v "\-" | \
grep -v "grep"`
echo "Current # of clients being served: $numclients"
if [ $numclients -eq 0 ]
then
exit
elif [ $numclients -eq 1 ]
then
echo "Current clients are: $client"
else
count=1
echo "`ps | grep 'server' | grep -v '\-' | \
grep -v 'grep' | awk '{ print $6 }'`" > /root/clients
echo -e "\nCurrent clients are:"
# while [ $count -le $numclients ]
for curclient in `cat /root/clients`
do
# I had to do this to get the \n in there
# curclient=`cat /root/clients | cut -d'
#' -f$count`
echo "$curclient"
# count=`expr $count + 1`
done
rm -f /root/clients
fi