AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

How do I kill process which is consuming more than 80% using shell script?

  • 1.  How do I kill process which is consuming more than 80% using shell script?

    Posted Mon December 07, 2009 03:47 PM

    Originally posted by: SystemAdmin


    Hello,

    We have been noticing some runaway Oracle forms processes on the form server for quite sometime. These processes normally consume very high CPU (80-90%). We then manually go and kill using kill comamnd.

    I would like to write a script which gives me the list of forms processes with CPU utilization in % so that I can kill the one which is consuming CPU > 80%. I tried several ps command options but I do not get correct % in the C column of ps command. How do I get the same % that shows with nmon or topas command with the ps command?

    Also, if I can get total duration for which the process is running, it would be great.

    Thanks in Advance.

    Sam


  • 2.  Re: How do I kill process which is consuming more than 80% using shell script?

    Posted Tue December 15, 2009 01:26 PM

    Originally posted by: nagger


    Hi,
    ps report process CPU use in terms of the whole machine =100%
    nmon reports process CPU use in terms on 1 CPU = 100%

    These are both right - just different.

    ps aux reports both total time on the CPU (TIME column) and the recent CPU use (%CPU)

    Good luck with your script.
    I can't help thinking
    1) ugh that is dangerous
    2) surely you should focus on fixing the cause andn ot the symptom
    3) I am not going to help script so I don't get the blame when perfectly good processes get killed

    ta Nigel