#!/bin/ksh
MONITOR_FILE=/tmp/monitor.lst
ps -aeF"pid=,pcpu=" | while read PID PCPU
do
if [[ -n "$PCPU" && "$PCPU" -gt 0.95 ]]
then
echo $PID >>$MONITOR_FILE
fi
done
cat $MONITOR_FILE | sort | uniq -c | while read HOWMANY PID
do
if [[ "$HOWMANY" -gt 10 ]]
then
echo $PID
fi
done | mail -s "PIDs Running >95%" user@system.com
|