diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-10-10 17:54:49 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-10-10 17:54:49 +0200 |
commit | bb633bde22cfe3d206c2a34c82a2d87aee8482e6 (patch) | |
tree | 609a2f26d5c72635697247fc1df6ed142144205d /scripts | |
parent | 20fc74f52742e5d512723d4f5fe314626e4a92f3 (diff) |
daemon.sh: fixed race condition
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/daemon.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/daemon.sh b/scripts/daemon.sh index 35dd08e83..a906253cd 100755 --- a/scripts/daemon.sh +++ b/scripts/daemon.sh @@ -44,6 +44,21 @@ else set -x ${2} -p "${NROOT}/nDPIsrvd-${NSUFFIX}.pid" -c "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" -s "${NROOT}/nDPIsrvd-${NSUFFIX}-distributor.sock" -d -L "${NROOT}/nDPIsrvd.log" test $? -eq 0 || RETVAL=1 + + MAX_TRIES=10 + while [ ! -S "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" -a ${MAX_TRIES} -gt 0 ]; do + sleep 0.5 + MAX_TRIES=$((MAX_TRIES - 1)) + done + test ${MAX_TRIES} -eq 0 && RETVAL=1 + + MAX_TRIES=10 + while [ ! -S "${NROOT}/nDPIsrvd-${NSUFFIX}-distributor.sock" -a ${MAX_TRIES} -gt 0 ]; do + sleep 0.5 + MAX_TRIES=$((MAX_TRIES - 1)) + done + test ${MAX_TRIES} -eq 0 && RETVAL=1 + sudo chgrp "$(id -n -g "${NUSER}")" "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" test $? -eq 0 || RETVAL=1 sudo chmod g+w "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" |