#!/bin/ash # Hostapd Startup Script # . /etc/rc.d/init.d/functions PIDFILE=/var/run/hostapd.pid if [ ! -x /usr/sbin/hostapd ]; then echo -n "Starting hostapd: /usr/sbin/hostapd not found " false check_status exit 0 fi if [ ! -f /etc/hostapd.conf ]; then echo -n "Starting hostapd: /etc/hostapd.conf not found " false check_status exit 0 fi case "$1" in start) echo -n "Starting hostapd: " hostapd -P "$PIDFILE" -B /etc/hostapd.conf check_status ;; stop) if [ -r "$PIDFILE" ]; then echo -n "Stopping hostapd: " kill `cat "$PIDFILE"` check_status else echo "Service hostapd not running." fi ;; restart) $0 stop $0 start ;; status) if [ -r "$PIDFILE" ]; then echo "Service hostapd running (PID $(cat "$PIDFILE"))." else echo "Service hostapd not running." fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac