#! /bin/sh

if [ $# -gt 0 ]
then
        echo "USER       PID %CPU %MEM  SIZE  RSS TTY STAT  START      TIME"
        ps -axuw | grep afpd | grep $1 | grep -v "grep afpd" | cut -c1-65
else
        echo "USER       PID %CPU %MEM  SIZE  RSS TTY STAT  START      TIME"
        ps -axuw | grep afpd | grep -v "grep afpd" | cut -c1-65
        echo
        echo 'total number of users logged on:'
        ps -axlw | grep afpd | grep -v "grep afpd" | wc -l
        echo
        echo 'main afpd status'
        afpdstat=`ps -axuw | grep root | grep afpd | grep -v "grep afpd"`
        if [ "$afpdstat" != "" ]
        then
                echo 'up'
        else
                echo 'DOWN'
        fi
        echo
        echo 'atalkd status'
        atalkdstat=`ps -ax | grep atalkd | grep -v "grep atalkd"`
        if [ "$atalkdstat" != "" ]
        then
                echo 'up'
        else
                echo 'DOWN'
        fi
fi
exit 0

________________________________________________________________
John Ostrowick                 jon@cs.wits.ac.za
Computer Science Department,   University of the Witwatersrand
1 Jan Smuts Ave, Johannesburg, South Africa. Senate House 1012
Phone: +27 11 716-3783         Fax: +27 11 339-3513
My web page: http://macaroni.cs.wits.ac.za/more/jon/aboutme.html
My ftp site: ftp://macaroni.cs.wits.ac.za
My listserv: http://macaroni.cs.wits.ac.za/listservs.html



