Operating System - HP-UX
1833495 Members
2646 Online
110052 Solutions
New Discussion

/bin/sh scripts: process still alive when the father die.

 
SOLVED
Go to solution
bernard bedetti
Occasional Contributor

/bin/sh scripts: process still alive when the father die.

I'd like to know if it is possible that a script 'X' (which contains a loop with a sleep) launched from another script 'Y', remains alive when the script 'Y' die ?
1. I think I have to use the trap instruction, but I don't know exactly how.
2. Could be another solution ?
I hope I'm clear enough !
2 REPLIES 2
Mark Grant
Honored Contributor
Solution

Re: /bin/sh scripts: process still alive when the father die.

Two things I can think of here.

Probably the most sensible thing is to run script X using the "nohup" command.

If you want to trap signals in a script, choose your signal "kill -l" will list the possible signals and do a

trap "" 2 for example.

I think SIGQUIT is the one you are after but signals get sent to all processes in a process group so you would have to trap pretty much everything for all the possible signals that might have killed the parent.



Never preceed any demonstration with anything more predictive than "watch this"
bernard bedetti
Occasional Contributor

Re: /bin/sh scripts: process still alive when the father die.

Thanks really a lot. It works fine with the 'nohup' instruction.