On Sun, Jul 25, 2010 at 04:54:53PM -0400, Chet Ramey wrote:
> On 7/25/10 8:51 AM, Julien Dessaux wrote:
> >     I have a script that trap USR1 for reloading purpose. The signal handler
> > then does some cleaning, then exec $0.
> 
> With BSD and Posix-style signals, the caught signal is automatically
> blocked by the kernel when executing its signal handler.  If you exec
> a new program out of the signal handler, it's going to be executed
> with that signal blocked.  From the new program's perspective, it really
> is as if you never left the signal handler.

I believe the typical workaround for this type of issue is to set a
variable in the signal handler, and then (outside the trap, in some sort
of main loop) check for that variable and do the real handling.

I've never developed a bash script that needed that sort of sophistication,
but that's how it's generally done in C.

Reply via email to