kill using the ps command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting kill using the ps command
# 1  
Old 03-06-2011
Bug kill using the ps command

hello, can anyone help me with a script that checks the status of processes and "kills" the process that's hanging? I mean I'm aware of the commands but I'm confused on how to put them all together... thanks! Smilie
# 2  
Old 03-07-2011
What is the criteria of the term "hanging" in your context?
100% CPU? ( thats not hang however), running for particularly longer time? or do you mean to say "zombie" process?
How do you going to determine that with "ps" ?!!
# 3  
Old 03-07-2011
ok I might have confused you a bit with the words I used, let me rephrase that. I need a script that uses the ps command to display the programs which uses the CPU the most and then kill the highest one...
# 4  
Old 03-07-2011
Quote:
I need a script that uses the ps command to display the programs which uses the CPU the most and then kill the highest one
As worded, such a script is madness.
A glance round a few sample systems which are running normally found the top CPU users to be the: disc daemon, a database engine; a background report. None of these are rogue processes. Also, on a multi-CPU system it is quite normal for a process to use 100% of one CPU.

Because there is much variation in the "ps" command, please post the exact Operating System and version you are running and what Shell you use.
Please also post a detailed tried-and-tested example of your "ps" command which identifies the faulty process(es).
# 5  
Old 03-07-2011
There will always be a process which is using the maximum of the CPU at a given time.

I think it might be a good idea to first find out the processes which are taking a lot of CPU space and can be killed. Then there can be a single line command that can work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Kill command

what is the difference between kill 5 and kill %5? the first one is to kill a process with PID 5 but what does the % mean in the second one? (3 Replies)
Discussion started by: chinababy
3 Replies

2. Shell Programming and Scripting

kill command in linux OS

How to undo the kill command in Linux OS? (9 Replies)
Discussion started by: poonam.gaigole
9 Replies

3. Shell Programming and Scripting

kill command

Good way to kill the process, if the process having it's child (3 Replies)
Discussion started by: pritish.sas
3 Replies

4. Solaris

Help with Kill Command

I am running Solaris 9. I have a problem with kill command. I'm sort of teaching myself so this might be a really stupid thing. I logged in as a normal user, lets say ABC, and then did "su" to root. After becoming root, I tried to kill the process started by ABC by saying kill -9 "pid of ABC" ... (3 Replies)
Discussion started by: the_red_dove
3 Replies

5. Shell Programming and Scripting

kill command issues

xxxxxx (8 Replies)
Discussion started by: kitty123
8 Replies

6. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

7. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

8. UNIX for Dummies Questions & Answers

Kill Command

Hi All, What is difference between kill & kill -9 command? Thanks & regards, Sonali (4 Replies)
Discussion started by: sonali
4 Replies

9. Programming

the kill command

is it possible to implement the kill command using C? (2 Replies)
Discussion started by: kelogs1347
2 Replies

10. UNIX for Dummies Questions & Answers

kill command

what is the kill command? (1 Reply)
Discussion started by: Rush
1 Replies
Login or Register to Ask a Question