Share your knowledge at the LQ Wiki.
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 11-17-2011, 10:54 PM   #1
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
system script

In my unix / linux server , there are always many process running in high CPU and use much memory , it makes the system run very slow .

Can advise if I would like to find it out , find and kill the processes which are

1) running over 3 hours with 90% CPU .
2) the process run over 12 hours

Can advise how can I write it ? or I guess these are very useful unix admin script , can advise where I can find the similiar one ?

Old 11-17-2011, 11:40 PM   #2
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Killing processes willy nilly via a script is probably not a good idea.

Look at top and ps to try and find out what is chewing the resources, and then try to diagnose why.

Killing critical system services (httpd on a webserver for example) is obviously, not a good idea.
Old 11-17-2011, 11:51 PM   #3
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 879

Rep: Reputation: 113Reputation: 113

If you kill random scripts that are using high resources you may render your system unstable. If need to investigate what is causing it. Some times this kinda thing can happen when you update your system and get a bug. I've had plenty of those in the past and just watched top mostly and figured it out. If this is a web server and your server becomes under a load due to high demand in request and it kills your web server then what happens lol. Think about what your doing and do it right.
Old 11-17-2011, 11:53 PM   #4
Registered: Nov 2011
Posts: 42

Rep: Reputation: Disabled
You can find how long a process is running by looking at the process tree and comparing your current time (might be some other easier way too, dunno).

You can also do a ps auxwww --sort pcpu to find out what's been chewing your CPU time but um... killing processes without knowing what they are could be bad.


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
Script to monitor system file system. dezavu Linux - Server 5 09-13-2011 02:04 AM
system backup script DebianUser Linux - Software 7 02-01-2011 01:06 AM
system script jackie1 Linux - Newbie 7 08-21-2009 01:52 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 10:40 PM
System command script RHrulz Mandriva 7 03-26-2005 12:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:33 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