Operating System - HP-UX
1748140 Members
3667 Online
108758 Solutions
New Discussion юеВ

find out Runaway processes

 
SOLVED
Go to solution
bin lu_1
Advisor

find out Runaway processes


We have application which many users are working in it. some users processes stay there too long,
after 12 hours there, they will qualify as runaway processes to report them each morning.

But we would not report background processes (owners are root, lp, www)

UNIX95= ps -eo user,pid,comm,etime | egrep -v 'root|lp|www'
vgoldenz 20214 ksh 01:06:27
aronan 18574 ksh 00:12
vgoldenz 20303 ksh 01:06:19
cvalenti 15158 sh 08:07
jteahan 17664 ksh 02:26
emariano 9651 ksh 18:52
sreaves 17623 mhotlist.exe 02:41
cpovitch 16621 ksh 05:28
cpovitch 16239 ewarnrpt.exe 06:23
bmulu 17069 buymnt.exe 04:57
rgursky 21363 sh 01:00:13
jdolan 14516 menuprow.exe 08:28
tbastian 2655 ksh 42:59
aronan 18606 matchrp1.exe 00:11
cpovitch 10108 ksh 17:05

In another machine, the "UNIX95= ps ..." command
oraprod 16671 oraclecyborg 07:01:20
oraprod 28094 ora_s000_cyborg 10-23:40:19
oraprod 28061 tnslsnr 10-23:41:22
pdziedzi 18020 smbd 01:40:41

the elapse time format as

within one hour
mm:ss

then,longer than one hour
hh:mm:ss

longer than 24 hour
d-hh:mm:ss

To get only hour (hh) value out in awk -F: As below command does not work well,
UNIX95= ps -eo user,pid,etime,comm | awk -F: '$3 >= 12'
My problem is hard to parse out hh value

Thank you
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: find out Runaway processes

If you use cyborg hr, its probably that oracle cyborg process.

Way to many cpu cycles.

Cyborg has patches to deal with runaway cvsvb batch processes.

The runaways in general are usually the ones with the most cpu cycles and percent on a top display.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: find out Runaway processes

The attached script should do what you want. Note than only those $3's with 2 colons are of interest so we can leverage split to look for those. We then call split another time, splitting on "-". This script should output those processes with total hrs >= 12. I leave the remainder of user and process name filtering to you.

Note the use of a function to build a fairly complex awk script and also note that I always add ($x + 0) to any field that should be a numeric value. This convention forces awk to evaluate in numeric context.

If it ain't broke, I can fix that.
bin lu_1
Advisor

Re: find out Runaway processes

Thank you steven and Stephenson.

I will late check the runaway patch fix. It is good direction to know information and work for that.

Stephenson script goes more than my expectation. It will also lead me to digest it later. It will be one chapter of my learning script bible.

Thank you all very much.