segfault/sfbin/wait_semaphore.sh
2022-08-01 18:26:57 +01:00

18 lines
328 B
Bash
Executable File

#! /bin/bash
# EXIT unless "$2" exists.
#
# This is used by Nginx to keep restarting until the EncFS
# is fully mounted.
trap "exit 255" SIGTERM
sem="$1"
shift 1
echo "Waiting for Semaphore '${sem}' before starting '$*'"
[[ -e "${sem}" ]] && exec "$@"
sleep 1
echo "Semaphore '${sem}' does not yet exist. Exiting."
exit 123