This is what I would like to do:
Run some four executables (alternatively, four scripts that run one executable
each) from within a script. Now the important thing is that I need to detect
that if any one of the four processes die or killed explicitly by using kill,
then I kill the remaining processes as well and restart them all over again.
I prefer C shell but am willing to use Bourne shell.
All I can think of is using Bourne Shell to get the pid of each executable I
fork off and then periodically check to see if they are all alive, if not, kill
all the other processes and restart. A better solution (that is not quite
fully resolved in my mind) would be that each forked off script could do
a wait and if the executable it forked off died, then it could send a signal
to the parent script which can trap it and do the rest of the processing
What happens if someone does a kill (especially -9) on the forked off script etc?
I would greatly appreciate if someone has any thoughts on this.