netplug: prevent starting multiple instances of netplugd
Executing "/etc/init.d/S29netplug start" multiple times resulted in multiple instances of netplugd. Pass "-p /var/run/netplug.pid" to netplugd, so it creates the PID file that start-stop-daemon needs to know that netplugd is already running. Also use the pid file to stop netplugd, instead of the daemon name. Fixes https://bugs.busybox.net/show_bug.cgi?id=10661 Reported-by: Joachim Krueger <mail2k@web.de> Signed-off-by: Carlos Santos <casantos@datacom.com.br> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
41a365d40b
commit
3c6a5bdd3e
|
@ -41,7 +41,7 @@ case "$1" in
|
||||||
start)
|
start)
|
||||||
# Start daemon.
|
# Start daemon.
|
||||||
printf "Starting network plug daemon: "
|
printf "Starting network plug daemon: "
|
||||||
start-stop-daemon -S -q -p /var/run/netplugd.pid -x /sbin/netplugd ${NETPLUGDARGS}
|
start-stop-daemon -S -q -x /sbin/netplugd -- -p /var/run/netplugd.pid ${NETPLUGDARGS}
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
|
||||||
|
@ -49,7 +49,7 @@ case "$1" in
|
||||||
stop)
|
stop)
|
||||||
# Stop daemon.
|
# Stop daemon.
|
||||||
printf "Shutting down network plug daemon: "
|
printf "Shutting down network plug daemon: "
|
||||||
start-stop-daemon -K -n netplugd
|
start-stop-daemon -K -q -p /var/run/netplugd.pid
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
|
||||||
|
|
Loading…
Reference in a new issue