2 # modified from prockmon
7 echo 'Check total CPU time and maximum memory usage of a process.'
8 echo 'need two parameters: $0 <interval> <pid>'
18 while [ $
(ps
-p $PID|
wc -l) -gt 1 ];do
19 REPORT
=`ps -o time,rss -p $PID | tail -1`
20 NLINE
=`ps -o time,rss -p $PID | wc -l`
21 ARR
=(${REPORT//\ +/ })
23 if [[ ${NLINE} -gt 1 ]];then
26 if [ $MEM -gt $MAXMEM ];then
33 echo 'CPU time (mm:ss):' $TIME
34 echo 'Max mem (KB):' $MAXMEM