Sample Header Ad - 728x90

trapping HUP/SIGHUP is not working in bash script

0 votes
0 answers
828 views
I have this bash script: https://gist.github.com/ORESoftware/06dbb26a48d2ddf48a5a2166834e0836 when I call ql_acquire_lock in a shell, if I can call mkdir on a directory, then I acquire that lock. When I call ql_release_lock, it removes that directory, simple stuff. Now, when ql_acquire_lock is called, it calls: trap ql_on_trap EXIT trap ql_on_trap SIGHUP trap ql_on_trap 0 if any of those signals are received, in theory, then ql_release_lock will get called: the **problem I have** is when I close a terminal window, my script does NOT capture the SIGHUP or 0 signal. When the user issues SIGINT, my trap is invoked, most certainly by EXIT. But when the user closes the terminal window (I believe that should send a SIGHUP) my script's trap does not capture the signal. Anyone know why that would be?
Asked by Alexander Mills (10744 rep)
Mar 15, 2018, 01:02 AM
Last activity: Mar 15, 2018, 04:47 PM