summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2014-11-14 04:52:00 -0500
committerArmin Kuster <akuster808@gmail.com>2014-12-26 17:50:17 -0800
commitad4734201b02f7acec08ad4571571e125d05b975 (patch)
treeff2509ba496416760b4ec9b0c210e148e63eb593
parenteaf285dc302e5fce489b63c918bc085cf370fb5a (diff)
downloadmeta-openembedded-ad4734201b02f7acec08ad4571571e125d05b975.tar.gz
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> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init27
1 files changed, 24 insertions, 3 deletions
diff --git a/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init b/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init
index 79f74b681..8ba4e0794 100644
--- a/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init
+++ b/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init
@@ -8,6 +8,23 @@ test -f $DAEMON || exit 0
8 8
9set -e 9set -e
10 10
11# source function library
12. /etc/init.d/functions
13
14delay_stop() {
15 count=0
16 while [ $count -lt 9 ] ; do
17 if pidof $DAEMON >/dev/null; then
18 sleep 1
19 else
20 return 0
21 fi
22 count=`expr $count + 1`
23 done
24 echo "Failed to stop $DESC."
25 return 1
26}
27
11case "$1" in 28case "$1" in
12 start) 29 start)
13 echo -n "Starting $DESC: " 30 echo -n "Starting $DESC: "
@@ -16,20 +33,24 @@ case "$1" in
16 ;; 33 ;;
17 stop) 34 stop)
18 echo -n "Stopping $DESC: " 35 echo -n "Stopping $DESC: "
19 start-stop-daemon -K -x $DAEMON 36 start-stop-daemon -K --oknodo -x $DAEMON
20 echo "$NAME." 37 echo "$NAME."
21 ;; 38 ;;
22 restart) 39 restart)
23 $0 stop 40 $0 stop
24 $0 start 41 delay_stop && $0 start
25 ;; 42 ;;
26 reload) 43 reload)
27 echo -n "Reloading $DESC: " 44 echo -n "Reloading $DESC: "
28 killall -HUP $(basename ${DAEMON}) 45 killall -HUP $(basename ${DAEMON})
29 echo "$NAME." 46 echo "$NAME."
30 ;; 47 ;;
48 status)
49 status $DAEMON
50 exit $?
51 ;;
31 *) 52 *)
32 echo "Usage: $0 {start|stop|restart|reload}" 53 echo "Usage: $0 {start|stop|restart|reload|status}"
33 exit 1 54 exit 1
34 ;; 55 ;;
35esac 56esac