Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Killing processes over 90% CPU usage

Status
Not open for further replies.

lhg1

IS-IT--Management
Mar 29, 2005
134
DK
Hi

I have some rouge processes that I want to preform an action on.

I can catch the processes. But I want to kill them if they are above 90%

Code:
ps -ef|grep telnet|grep -v grep
test      1340342    1361850 99.9 09:02:05 ??          26:14.86 telnet
test      1361863    1335038 99.7 09:02:04 ??          26:18.01 telnet

I could put then into a variable an then run throu them, what I was wondering was if there is a way to set it up in one line?

Regards
Lhg
 
Try
Code:
kill $(ps -ef | awk '/telnet/ && ! /awk/ && $4 > 90 {print $2}')

A little testing is advised!

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top