3 # Example of how to safely release the lock in the "post" hook.
5 # Copyright (C) 2018 Antonio Ospite <ao2@ao2.it>
6 # SPDX-License-Identifier: WTFPL
8 # This program is free software. It comes without any warranty, to
9 # the extent permitted by applicable law. You can redistribute it
10 # and/or modify it under the terms of the Do What The Fuck You Want
11 # To Public License, Version 2, as published by Sam Hocevar. See
12 # http://sam.zoy.org/wtfpl/COPYING for more details.
16 LOCKDIR=/run/lock/mylockdir
17 LOCKPID=$(cat "$LOCKDIR/pid")
18 [ "$LOCKPID" = $PPID ] || { echo "The enter script was launched from another process. Unlocking aborted." >&2; exit 1; }