Find processes over time limit (Rated 0)Description:
Find non root processes with more than TLIMIT minutes of CPU time. Code starts here
#!/bin/sh
# 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
Submitted by Devscripts on 26-02-2003 17:04 |