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.
This commit is contained in:
oblique 2015-05-17 18:44:04 +03:00
parent ee69810dc5
commit 92d35c0da3

View File

@ -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