Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/bin/ksh
if [ ! -f /usr/local/out/ps.before ] ; then
ps -e -o pid,vsz,ruser,etime,args | \
awk '{print $1","$2","$3","$4","$5,$6,$7,$8,$9,$10,$11,$12}' | \
grep -v defunct > /usr/local/out/ps.before
fi
ps -e -o pid,vsz,ruser,etime,args | \
awk '{print $1","$2","$3","$4","$5,$6,$7,$8,$9,$10,$11,$12}' | \
grep -v defunct > /usr/local/out/ps.after
cat /usr/local/out/ps.before /usr/local/out/ps.after > /usr/local/out/ps.total
cat /usr/local/out/ps.after | \
awk -F, '! /PID/{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11}' | \
while read pid vsz ruser etime command a b c d e f
do
num_procs=`grep "^${pid}," /usr/local/out/ps.total | wc -l | tr -d ' '`
if [ "${num_procs}" -eq 2 ] ; then
after_vsz=`grep "^${pid}," /usr/local/out/ps.before | awk -F, '{print $2}'`
((delta=vsz-after_vsz))
echo "${pid}\t${vsz}\t\t${after_vsz}\t\t${delta}\t${ruser}\t${etime}\t${command} $a $b $c $d $e $f"
fi
done > /usr/local/out/ps.after.tmp
clear
echo "PID\tVSZ SIZE BEFORE\tVSZ SIZE AFTER\tDELTA\tUSER\tELAPSED TIME\tCOMMAND"
echo "---\t---------------\t--------------\t-----\t----\t------------\t-------"
sort +3 /usr/local/out/ps.after.tmp
VSB=`cat /usr/local/out/ps.after.tmp | awk '{ sum += $2 } END { print "Total VSZ Before: ", sum }'`
VSA=`cat /usr/local/out/ps.after.tmp | awk '{ sum += $3 } END { print "Total VSZ After: ", sum }'`
DELTA=`cat /usr/local/out/ps.after.tmp | awk '{ sum += $4 } END { print "Total Delta: ", sum }'`
start_date=`ls -la /usr/local/out/ps.before | awk '{print $6,$7}'`
echo "\n\nRunning against ps.before file with date of: ${start_date}"
echo "\n\n${VSB}"
echo "${VSA}"
echo "${DELTA}"
echo "Total Defunct Processes Found: `ps -ef | grep [d]efunct | wc -l | tr -d ' '`"