Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-27-2011, 08:17 PM   #1
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
Check process

I would like to find the server process which use high CPU ( ie. run over 10 hours and use 90 % CPU time ) and then kill such process , can advise how to write such script ?

Old 10-27-2011, 08:58 PM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288

automatically killing processes is a little dangerous (especially if you are doing it as root). You might do better to automate identifiying such processes, and then manually kill them. Have a look at the ps and top commands. Study the man pages and look for examples online. You can then write a script that uses ps or top to find suspicious CPU hogging processes and then send you an email if it finds something.



PS. If using top in a script make sure you look at the -b (batch mode) option.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
check timespan of a process kais1 Linux - Newbie 1 06-14-2011 03:16 PM
How to check disk IO per PROCESS ? dmor Linux - Server 5 09-08-2008 08:50 AM
check process ust Linux - Software 5 03-05-2008 02:46 AM
Check is process is running? Zeno McDohl Programming 2 08-13-2007 07:48 PM
Check the process sunhui Linux - Software 5 03-01-2006 07:07 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration