exit-post-hook-unlock.sh: use a trap to release the lock Use a trap to release the lock, this way the lock would be more robustly released when the exit hook is called, even if some commands in the exit hook failed.
exit-post-hook-unlock.sh: exit gracefully if LOCKDIR does not exist If LOCKDIR does not exist it means that the lock is not active so there's no need to do anything.
Initial import