From 92d35c0da301adc4aba05392959b66b729bc8c46 Mon Sep 17 00:00:00 2001 From: oblique Date: Sun, 17 May 2015 18:44:04 +0300 Subject: [PATCH] Fix daemonize infinite loop If `DAEMONIZE=1' is set in the config file then create_ap tries to create daemon process all the time. This is done because we were removing `--daemon' option from the parameters of the daemon process. We fix this by using an environment variable instead. --- create_ap | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/create_ap b/create_ap index b399338..9a50548 100755 --- a/create_ap +++ b/create_ap @@ -1065,16 +1065,10 @@ if [[ $FIX_UNMANAGED -eq 1 ]]; then exit 0 fi -if [[ $DAEMONIZE -eq 1 ]]; then - # remove --daemon - NEW_ARGS=( ) - for x in "${ARGS[@]}"; do - [[ "$x" != "--daemon" ]] && NEW_ARGS+=( "$x" ) - done +if [[ $DAEMONIZE -eq 1 && $RUNNING_AS_DAEMON -eq 0 ]]; then echo "Running as Daemon..." - # run a detached create_ap - setsid "$0" "${NEW_ARGS[@]}" & + RUNNING_AS_DAEMON=1 setsid "$0" "${ARGS[@]}" & exit 0 fi