Shell script to find processes with lots of CPU time
Here it is, a shell script.
###################### cut here ########################
#!/bin/sh
# By Steven.Hauser-1@tc.umn.edu
# Find non root processes with more than TLIMIT minutes of CPU time.
# For machine Sun Solaris 2.6
# MINUTES equals the first parameter or 5 if no parameter.
MINUTES=$1
MINUTES=${MINUTES:=5}
AWK=/usr/bin/nawk
ps -ef |
$AWK 'BEGIN {TLIMIT='$MINUTES'}
$7 ~ ":" { split ($7,t,":");
if (t[1] >= TLIMIT) {print $0 }}
$8 ~ ":" { split ($8,t,":");
if (t[1] >= TLIMIT) {print $0}}' |
grep -v root | sort
###################### cut here ########################