source: clfs-embedded/bootscripts/clfs/rc.d/init.d/hostapd@ 5ac6f32

Last change on this file since 5ac6f32 was fcb2663, checked in by Maarten Lankhorst <mlankhorst@…>, 15 years ago

bootscripts: Really die in hostapd if config not found

  • Property mode set to 100755
File size: 862 bytes
Line 
1#!/bin/ash
2
3# Hostapd Startup Script
4#
5
6. /etc/rc.d/init.d/functions
7
8PIDFILE=/var/run/hostapd.pid
9
10if [ ! -x /usr/sbin/hostapd ]; then
11 echo -n "Starting hostapd: /usr/sbin/hostapd not found "
12 false
13 check_status
14 exit 0
15fi
16
17if [ ! -f /etc/hostapd.conf ]; then
18 echo -n "Starting hostapd: /etc/hostapd.conf not found "
19 false
20 check_status
21 exit 0
22fi
23
24case "$1" in
25start)
26 echo -n "Starting hostapd: "
27 hostapd -P "$PIDFILE" -B /etc/hostapd.conf
28 check_status
29 ;;
30stop)
31 if [ -r "$PIDFILE" ]; then
32 echo -n "Stopping hostapd: "
33 kill `cat "$PIDFILE"`
34 check_status
35 else
36 echo "Service hostapd not running."
37 fi
38 ;;
39restart)
40 $0 stop
41 $0 start
42 ;;
43status)
44 if [ -r "$PIDFILE" ]; then
45 echo "Service hostapd running (PID $(cat "$PIDFILE"))."
46 else
47 echo "Service hostapd not running."
48 fi
49 ;;
50*)
51 echo "Usage: $0 {start|stop|restart|status}"
52 exit 1
53esac
Note: See TracBrowser for help on using the repository browser.