The second fork lets you have two processes: one to run ssh, and the other to catch a HUP signal and do whatever it likes to the ssh server. The problem with your existing code is that when you run exec, the signal handler is cleared; using fork too lets you have one process with a signal handler of your choice, and a second process running ssh.
I'm not sure that this has an advantage over not doing the second fork and just keeping the PID's that ran exec in %PIDPOOL.
In reply to Re: Re: Re: Re: Re: Signals and subprocesses using fork, and system or exec.
by sgifford
in thread Signals and subprocesses using fork, and system or exec.
by exussum0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |