home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume2
/
shstat
/
shstat.sh
Wrap
Linux/UNIX/POSIX Shell Script
|
1991-08-07
|
2KB
|
67 lines
#!/bin/sh
# @(#)@ show_status 1.9 show system activity
# @(#)@ Copyright 1988 by Johan Vromans - Multihouse Research
# Contributed to Public Domain by the Author, Feb 15, 1988
# This is a little shell script which repeatedly displays the current
# system activity, filtering out unneeded entries.
#
# Display uses tty enhancements, if present.
#
# Usage: show_status [ sleep-value ]
title="Multihouse USENET Gateway" # descriptive title of this system
trap "rm -f /tmp/tmpa$$; trap '' 0; exit" 0 1 2 3 15
# get display interval
sleep="$1"
if [ "$sleep" = "" ]
then
sleep=20
fi
# get terminal enhancements
home=`tput home`
home=${home:-`tput khome`}
home=${home:-`tput clear`}
clear=`tput ed`
cln=`tput el`
so=`tput smso`
se=`tput rmso`
# please keep the next line intact
echo "$home`tput clear`show_status version 1.9 - Multihouse Research"
# build top display line
line=`ps -f | line | sed \
-e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" \
-e "s/^\(.....................\).../\1/"`
line="$so$line $se"
# other relevant data
pid=$$
set `uname -a` # KEEP LAST - SCRIPT USES $1, $2 and so on ...
# and here we go ... until interrupted
while [ a = a ]
do
echo "$home$so $2 $1/$3 `date` $title $se$cln\n"
# don't use a pipe - unwanted processes show up!
ps -ef > /tmp/tmpa$$
echo "$line"
sort +1n -2 < /tmp/tmpa$$ | sed \
-e "/ -sh/d" \
-e "/ -csh/d" \
-e "/ -ksh/d" \
-e "1d" \
-e "/ $pid /d" \
-e "\./etc/getty.d" \
-e "s/^\(.....................\).../\1/" \
-e "s/\$/$cln/"
echo "$clear\c"
sleep $sleep
done