Subject: Re: [netatalk-admins] not quite 'top' but
From: Nicolai Langfeldt (janl@math.uio.no)
Date: Mon Oct 27 1997 - 04:39:08 EST
jon@colossus.cs.wits.ac.za (John Ostrowick) tastet:
> the following is a script i made to show who was logged in.
...
Yes, that's cool.
However running ps all those times was slow. Here is my version,
it runs ps only once. It's for ksh, but everyone has ksh, right?
#!/bin/ksh
runps () {
STATUS="$(ps axuw)"
AFPSTATUS=$(print -n "$STATUS" | grep afpd)
print -n "$STATUS" | head -1
}
case $# in
1) runps
print "$AFPSTATUS" | grep "$1"
exit 0;;
0) :;;
*) print "Usage: awho [user]"
exit 0;;
esac;
runps
print "$AFPSTATUS\n"
print 'total number of users logged on: ' $(print -n "$AFPSTATUS" | wc -l)
print -n 'main afpd status: '
case $AFPSTATUS in
'') print DOWN;;
*) print up;;
esac
print -n 'atalkd status: '
case $(print -n "$STATUS" | grep atalkd) in
'') print DOWN;;
*) print up;;
esac
exit 0
This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:27:46 EST