Skip to content

Commit 81603be

Browse files
committed
updated hostapd start script, added readme for scripts folder
1 parent 2c519f7 commit 81603be

File tree

2 files changed

+40
-28
lines changed

2 files changed

+40
-28
lines changed

scripts/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
|Script|Live Dir|
2+
|coderbot|/etc/init.d/|
3+
|hostapd|/etc/init.d/|
4+
|interfaces_ap|/etc/network/|
5+
|interfaces_cli|/etc/network/|
6+
|pigpiod|/etc/init.d|
7+
|hostapd.conf|/etc/hostapd/|
8+
|dnsmasq.conf|/etc/|
9+
10+
11+
Note that scripts in the init.d folder need to be enabled/disabled as
12+
described in [Starting Coderbot](https://github.com/explosivose/coderbot_lboro/wiki/Starting-Coderbot).
13+
14+

scripts/hostapd

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,50 @@
1414
### END INIT INFO
1515

1616
PATH=/sbin:/bin:/usr/sbin:/usr/bin
17-
DAEMON_SBIN_1=/usr/sbin/hostapd.RT5370
18-
DAEMON_SBIN_2=/usr/sbin/hostapd.RTL8188
19-
DAEMON_DEFS_1=/etc/hostapd/hostapd.RT5370
20-
DAEMON_DEFS_2=/etc/hostapd/hostapd.RTL8188
21-
DAEMON_CONF=
17+
DAEMON_SBIN=/usr/sbin/hostapd
18+
DAEMON_DEFS=/etc/default/hostapd
19+
DAEMON_CONF=/etc/hostapd/hostapd.conf
2220
NAME=hostapd
2321
DESC="advanced IEEE 802.11 management"
2422
PIDFILE=/var/run/hostapd.pid
2523

26-
[ -x "$DAEMON_SBIN_1" ] || exit 0
27-
[ -s "$DAEMON_DEFS_1" ] && . /etc/default/hostapd
24+
[ -x "$DAEMON_SBIN" ] || exit 0
25+
[ -s "$DAEMON_DEFS" ] && . /etc/default/hostapd
2826
[ -n "$DAEMON_CONF" ] || exit 0
2927

30-
DAEMON_OPTS="-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF"
3128

3229
. /lib/lsb/init-functions
3330

34-
case "$1" in
35-
start)
31+
do_start() {
3632
log_daemon_msg "Starting $DESC" "$NAME"
37-
echo "starting 1"
38-
start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_SBIN_1" --pidfile "$PIDFILE" -- $DAEMON_DEFS_1 >/dev/null
39-
echo "starting 2"
40-
start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_SBIN_2" --pidfile "$PIDFILE" -- $DAEMON_DEFS_2 >/dev/null
41-
echo "$?"
42-
log_end_msg "$?"
43-
;;
44-
stop)
45-
log_daemon_msg "Stopping $DESC" "$NAME"
46-
start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_SBIN_1" --pidfile "$PIDFILE"
47-
start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_SBIN_2" --pidfile "$PIDFILE"
48-
log_end_msg "$?"
33+
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile \
34+
--startas $DAEMON_SBIN -- $DAEMON_CONF
35+
log_end_msg $?
36+
}
37+
38+
do_stop() {
39+
log_daemon_msg "Stopping $NAME"
40+
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
41+
log_end_msg $?
42+
}
43+
44+
case "$1" in
45+
start|stop)
46+
do_${1}
4947
;;
5048
reload)
5149
log_daemon_msg "Reloading $DESC" "$NAME"
52-
start-stop-daemon --stop --signal HUP --exec "$DAEMON_SBIN_1" --pidfile "$PIDFILE"
53-
start-stop-daemon --stop --signal HUP --exec "$DAEMON_SBIN_2" --pidfile "$PIDFILE"
50+
start-stop-daemon --stop --signal HUP --exec "$DAEMON_SBIN" \
51+
--pidfile "$PIDFILE"
5452
log_end_msg "$?"
5553
;;
5654
restart|force-reload)
57-
$0 stop
58-
sleep 8
59-
$0 start
55+
do_stop
56+
sleep 8
57+
do_start
6058
;;
6159
status)
62-
status_of_proc "$DAEMON_SBIN_1" "$NAME"
60+
status_of_proc "$DAEMON_SBIN" "$NAME"
6361
exit $?
6462
;;
6563
*)

0 commit comments

Comments
 (0)