Sometimes a shell script needs to prevent itself from being called multiple times concurrently. This is a locking problem: http://wiki.bash-hackers.org/howto/mutex https://gist.github.com/przemoc/571091 However, in case where the script in question prepares the work for some other operation (e.g. the script is a "pre hook") it is typically called from another program, interleaved with other processes, and so locking and unlocking cannot be in the same script. By using a symmetrical "post hook", assuming that it is called by the same process which called the "pre hook", the parent PID can be used as a condition value, thus locking and unlocking can be performed in two distinct scripts.