Find PID's

I have a script which spawns multiple compilations.

Sometimes due to some errors i have to terminate that script.
Now comes the main part, how do I do that?

I can see the individual compilations via
ps -ef | grep compiler
and also kill them via
kill -9 pid

But the scirpt continues:

How do i find out which is the master script which gave birth to all these sub-processes.
This can't be a single step of seeing the PPID in the ps, as its a 3-4 step parent-child process.

Thanks.

Which OS are you using? If it's solaris use the ptree command - it's pretty handy at showing process trees.

I think Linux has a ps --forest option (or some such) that may prove useful and gives an ASCII art style process tree.

Cheers
ZB

Thanks,

Presently i am working on Solarish and HP.

Your ptree worked excellently on Solaris.

Can we have a general process which we can utilise in all flavours.