in reply to Re: Signals and END block
in thread Signals and END block
The halt script indeeds clarifies this question. First a TERM signal and after 5 seconds a KILL signal.
Why not having the cleanup code in the signal handler itself, though?
It also needs to execute when the programs ends normally, so the END block is probably the best place.
Why don't you try to detect and delete the stale database record at startup if possible?
Since I store the PID value of the process in a database, this PID might be re-used by the operating system when deleting the record at startup.
Thanks for your helpful input.