in reply to (slightly OT) catching SIGTERM when system goes down
Here's the clincher however: 5 seconds after this SIGTERM, init follows this up with a SIGKILL, which is not trappable. In your script, as Tomte has suggested, the actual action to be taken upon receipt of the signal is deferred until later (the handler just sets a flag variable). It might be the case that your script simply does not get to reading the flag variable before those 5 seconds are up. Try adding something in sub handler that logs receipt of the signal, so you can verify whether you actually receive it and are just too late to act upon it.
CU
Robartes-
|
|---|