From 505eb19aa42e47d265f53d9ac1c9d7fe0ed34b1f Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Fri, 7 Apr 2017 11:26:58 +0200 Subject: [PATCH] hostapd: let start-stop-daemon create PID and background process The current script cannot launch the hostapd twice (for dual HostAP mode) because start-stop-daemon finds an already existing PID for hostapd after running the first instance. The solution is: - Do not launch the hostapd in background (so that it does not fork the process, which assigns a different PID) - Use -b option of start-stop-daemon so that it launches the daemon in the background. - Let start-stop-daemon create the PID (since the hostapd will not fork now this PID will match the hostapd process, allowing to kill it later) This solution also hides the hostapd log messages that appeared before. Signed-off-by: Hector Palacios https://jira.digi.com/browse/DEL-4045 --- meta-digi-dey/recipes-connectivity/hostapd/hostapd/init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/init b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/init index 964d7e79c..cfd6eee7b 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/init +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/init @@ -3,7 +3,7 @@ DAEMON=/usr/sbin/hostapd NAME=hostapd DESC="HOSTAP Daemon" PIDFILE="/var/run/hostapd.${IFACE}.pid" -ARGS="/etc/hostapd_${IFACE}.conf -B -P ${PIDFILE}" +ARGS="/etc/hostapd_${IFACE}.conf" test -f $DAEMON || exit 0 @@ -29,7 +29,7 @@ delay_stop() { case "$1" in start) echo -n "Starting $DESC: " - start-stop-daemon -S -x $DAEMON -- $ARGS + start-stop-daemon -S -x $DAEMON -m -p ${PIDFILE} -b -- $ARGS echo "$NAME." ;; stop)