LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-27-2011, 09:17 PM   #1
ust
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 ?

Thanks.
 
Old 10-27-2011, 09:58 PM   #2
evo2
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
Hi,

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.

Cheers,

Evo2.

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


Reply


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 04:16 PM
How to check disk IO per PROCESS ? dmor Linux - Server 5 09-08-2008 09:50 AM
check process ust Linux - Software 5 03-05-2008 03:46 AM
Check is process is running? Zeno McDohl Programming 2 08-13-2007 08:48 PM
Check the process sunhui Linux - Software 5 03-01-2006 08:07 AM


All times are GMT -5. The time now is 05:51 AM.

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