mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-05-08 17:39:24 +00:00
hostapd: several fixes for init script
* restart: The stop may delay a few seconds according to different wireless devices, on debian/ubuntu, the init script directly sleep 8 seconds to wait the stop complete, here we add a delay function (sleep in a loop) to ensure the stop is completed before start. * add status command. * add --oknodo for stop so it will not break restart if there is no running process. Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
committed by
Martin Jansa
parent
890a034a46
commit
8da5b698fc
@@ -8,6 +8,23 @@ test -f $DAEMON || exit 0
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
delay_stop() {
|
||||||
|
count=0
|
||||||
|
while [ $count -lt 9 ] ; do
|
||||||
|
if pidof $DAEMON >/dev/null; then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
count=`expr $count + 1`
|
||||||
|
done
|
||||||
|
echo "Failed to stop $DESC."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo -n "Starting $DESC: "
|
echo -n "Starting $DESC: "
|
||||||
@@ -16,20 +33,24 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Stopping $DESC: "
|
echo -n "Stopping $DESC: "
|
||||||
start-stop-daemon -K -x $DAEMON
|
start-stop-daemon -K --oknodo -x $DAEMON
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
$0 stop
|
$0 stop
|
||||||
$0 start
|
delay_stop && $0 start
|
||||||
;;
|
;;
|
||||||
reload)
|
reload)
|
||||||
echo -n "Reloading $DESC: "
|
echo -n "Reloading $DESC: "
|
||||||
killall -HUP $(basename ${DAEMON})
|
killall -HUP $(basename ${DAEMON})
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
|
status)
|
||||||
|
status $DAEMON
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart|reload}"
|
echo "Usage: $0 {start|stop|restart|reload|status}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user