I'm currently trying to develop a script which will find the child processes of a process ID already passed to the script.
I then need the script to look for spawned processes of these child processes and so on until it can't find any more.
For example
At the moment, I have to manually do this on the server -
I need to find child/spawned processes of 7133 so straight away, I need to grep for 7134.
Next, I get 7137
You get the idea. There are also cases where one parent process spawns multiple child processes and I need to be able to trace these down individually.
I then need to build a list of all these process ids so that I can kill -9 them.
I've build a script part way and thought I'd be able to assign the processes IDs to a variable using something like this:
This has failed to work because of multiple processes numbers appearing on the same line.
The script is using KSH.
Any help would be greatly appreciated (as I'm quickly running out of hair!)
Almost got there! - not quite though - pgrep -P isn't reporting any further child processes...
Should pgrep -P be reporting proc ID 18480 as well?
---------- Post updated 22-10-10 at 08:55 AM ---------- Previous update was 21-10-10 at 02:57 PM ----------
I've managed to get it working (sort of).
Part of the exercise is to kill off the parent process of the problem processes anyway using another script. Therefore, once these have been killed, I'm only left with the proceses from 7133 downwards.
Here is the output of top command
So you see 99% of memory is in use -> Mem: 66005468k total, 65662548k used,
How can I find out all processes consuming this 99% memory in descending order of consumption i.e. starting with processes eating more memory.
I need the total of the output to... (3 Replies)
How do I list the process in a Unix based system which are running in background?
The following are options that I'm aware of, but they may not be appropiate.
a. using ps -ef , and getting records of processes for which STATUS='S'(uninterruptible sleep)
b. using jobs -l, and filtering... (5 Replies)
I am trying to kill a list of processes. I have found these two ways to list a group of process id's on a single line. How would I go about killing all of these processes all on one line?
$ ps aux | grep 6243 | grep "a.out" | awk '{printf "%s ",$2}'ps aux | grep 6243 | grep "a.out" | awk... (8 Replies)
Hello All
I am trying to get a list of process or applications runninging on the network only. I should emphasize that im not interested in the application or process if its not using the network.
I tried the good old netstat comand, but im not able to figure out how to list the running... (8 Replies)
Hi:
How to list processes from all hosts, as opposed to the one you are working at?
"ps ux" appears to list processes of the user on a single host only.
Thanks.
N.B Phil (5 Replies)
ps -xfu <user name> this command line will list all the process currently running for <user name>.
I need to filter this output. I need all the process which are running for more than 3 days(excluding demon/sys process) . The list should include PID, PPID, STIME, process/command.
I am using... (20 Replies)
Hi there,
I've install a testserver with SLES 11.0! I'll install/test XEN + WebServer not all things at the moment!
In a first time, I'd like to stop all unuse processes... but I don't understand all processes!
As someone a list of all processes with his signification and which should/could... (3 Replies)
I am trying to get the number of cpus on a farm of linux boxes (about 100 of them) by 'sshing' to each of them and checking their /proc/cpuinfo file.
So I have a local script localscript.sh on each of those 100 machines which retrieves the number of cpus in it by using its /proc/cpuinfo file.... (1 Reply)
Dear Unix Gurus,
Here is my query.
If i start a script,it inturn calls many other scripts ..and most of them continue to run in parallel.
Suppose,if i want to stop my script for some reason,i need to kill -9 each of the processes running.It becomes clumsy if the sub processes r more.
... (15 Replies)