diff options
Diffstat (limited to 'meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init')
-rw-r--r-- | meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init b/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init new file mode 100644 index 000000000..8ba4e0794 --- /dev/null +++ b/meta-oe/recipes-connectivity/hostapd/hostapd-2.2/init | |||
@@ -0,0 +1,58 @@ | |||
1 | #!/bin/sh | ||
2 | DAEMON=/usr/sbin/hostapd | ||
3 | NAME=hostapd | ||
4 | DESC="HOSTAP Daemon" | ||
5 | ARGS="/etc/hostapd.conf -B" | ||
6 | |||
7 | test -f $DAEMON || exit 0 | ||
8 | |||
9 | set -e | ||
10 | |||
11 | # source function library | ||
12 | . /etc/init.d/functions | ||
13 | |||
14 | delay_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 | |||
28 | case "$1" in | ||
29 | start) | ||
30 | echo -n "Starting $DESC: " | ||
31 | start-stop-daemon -S -x $DAEMON -- $ARGS | ||
32 | echo "$NAME." | ||
33 | ;; | ||
34 | stop) | ||
35 | echo -n "Stopping $DESC: " | ||
36 | start-stop-daemon -K --oknodo -x $DAEMON | ||
37 | echo "$NAME." | ||
38 | ;; | ||
39 | restart) | ||
40 | $0 stop | ||
41 | delay_stop && $0 start | ||
42 | ;; | ||
43 | reload) | ||
44 | echo -n "Reloading $DESC: " | ||
45 | killall -HUP $(basename ${DAEMON}) | ||
46 | echo "$NAME." | ||
47 | ;; | ||
48 | status) | ||
49 | status $DAEMON | ||
50 | exit $? | ||
51 | ;; | ||
52 | *) | ||
53 | echo "Usage: $0 {start|stop|restart|reload|status}" | ||
54 | exit 1 | ||
55 | ;; | ||
56 | esac | ||
57 | |||
58 | exit 0 | ||