Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to kill process and his children?

Status
Not open for further replies.

tomecki24

Programmer
Jun 13, 2001
52
DE
Hello,

I've got a question.
I'm using Solaris 7.
I'm starting a script, which starts another one, which starts the last one. When I kill the first script the both two are still working.
How can I kill them all?

Thanks
Tomasz
 
How does the first script start the other 2? Does it use nohup?

Greg.
 
Are these processes related to the first? (look at the output of ps -ef <process>). If they are and they're not being killed when the parent dies, are they being designated <defunct>? Can you post back with the output of your ps. Thanks.
 
Hello,

So, the first script is like this (mb_start.sh):
#!/bin/ksh
clear
/usr/storck/mb/bin/mb_bank > /usr/storck/mb/log/mb_bank_output.log &

The second one, mb_bank:
/usr/tibco/mb/bin/mbengine.sh -repourl tibcr://TestBAPI:service=7500:network=IP:daemon=tcp:IP:7500 -transformation TransName -engine TransEngine

And the third (mbengine.sh - already written) is:
... a lot of variables ...
/usr/j2se/bin/java -Xms8mb -Xmx64mb -Dae=TIBMBengine -Dcfg.editors=com.tibco.mb.ui.MessageBrokerEditor -classpath &quot;$LOCAL_MB_CLASSPATH&quot; com.tibco.mb.engine.EngineMode $*

Tomasz
 
Hello,

Here is the result of ps:

tibco 16605 1 0 11:49:19 pts/9 0:00 /bin/sh start_mb

tibco 16606 16605 0 11:49:19 pts/9 0:00 /bin/sh /usr/tibco/mb/bin/mbengine.sh -repourl tibcr://TestBAPI:service=7500:ne

tibco 16607 16606 0 11:49:19 pts/9 0:11 /usr/j2se/bin/../bin/sparc/native_threads/java -Xms8mb -Xmx64mb -Dae=TIBMBengin

When I will kill the first process, the other run normally.

Best regards
Tomasz
 
Guess: Could be that because your first script is put in the background with &, it doesn't send a kill to the spawned processes when it is killed. What happens if you don't put it in the background (if it's possible to test it like that)?
 
hello,

Yes, that's right, the first script is in background.
When I start it normally (in foreground I mean), Ctrl+C kills everything.
But the problem is I need them to be run in background, becuse they are java classes, and they &quot;lock&quot; terminal.

Best regards
Tomasz
 
Try putting &quot;.$$&quot; at the end of each command. This should start all the processes with the same PID. Like this:

/usr/storck/mb/bin/mb_bank /usr/storck/mb/log/mb_bank_output.log.$$ &

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top