LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Check process (https://www.linuxquestions.org/questions/linux-newbie-8/check-process-910566/)

ust 10-27-2011 08:17 PM

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.

evo2 10-27-2011 08:58 PM

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.


All times are GMT -5. The time now is 01:42 PM.