Re: check program time (75 Views)
Reply
Advisor
bin lu_1
Posts: 22
Registered: ‎11-01-2004
Message 1 of 6 (75 Views)

check program time

We have over average 70+ users login using an application in production hours.

Sometimes, few of their programs "runaway" or were loop inside in Unix. then later those useless processes to the top of other running programs by different users.

Users use top to find out those runaway processes running. But our SA hope know those processes as early as we can.

I tried to time command to find them (runaway processes) in early stage. For example, find the processes stay alive 5 minutes long.

Does any one know how to get a process 5 minutes long command. I hope that I could put them in script, try to send me a email if a assigned time broken.

Thanks,

Bin
Please use plain text.
Honored Contributor
Simon Hargrave
Posts: 744
Registered: ‎06-15-1998
Message 2 of 6 (75 Views)

Re: check program time

You can check the "elapsed" time for process on your server with something like:

UNIX95= ps -eo pid,etime,comm | grep procname

The format of the etime parameter is:

DAYS-HOURS:MINUTES:SECONDS

You can use this to check for MINUTES > 5
Please use plain text.
Honored Contributor
Simon Hargrave
Posts: 744
Registered: ‎06-15-1998
Message 3 of 6 (75 Views)

Re: check program time

In fact to find all process called "procname" that have been running for 5 minutes or more: -

UNIX95= ps -eo pid,etime,comm | awk -F: '$2 >= 5 && /procname/'
Please use plain text.
Advisor
bin lu_1
Posts: 22
Registered: ‎11-01-2004
Message 4 of 6 (75 Views)

Re: check program time

It works very well in Linux. I am using HP-UX, I was trying to find the same command in HP-UX

`ps -eo pid,etime,comm` does not work in HP-UX, yet.

Thank you



Please use plain text.
Advisor
bin lu_1
Posts: 22
Registered: ‎11-01-2004
Message 5 of 6 (75 Views)

Re: check program time

OK, I checked more. actually the whole command you gave work on HP-UX,

Below part work for Linux
ps -eo pid,etime,comm | awk -F: '$2 >= 5 && /bonobo-activati/'

Thank yopu very much
Please use plain text.
Advisor
bin lu_1
Posts: 22
Registered: ‎11-01-2004
Message 6 of 6 (75 Views)

Re: check program time

Thank you this forum platform is good
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation