File hostapd.init of Package hostapd

#!/bin/sh
#
#     SUSE system startup script for hostapd
#     Copyright (C) 1995--2005  Kurt Garloff, SUSE / Novell Inc.
#     Copyright (C) 2011  SUSE Linux Products GmbH
#          
#     This library is free software; you can redistribute it and/or modify it
#     under the terms of the GNU Lesser General Public License as published by
#     the Free Software Foundation; either version 2.1 of the License, or (at
#     your option) any later version.
#			      
#     This library is distributed in the hope that it will be useful, but
#     WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#      
#     You should have received a copy of the GNU Lesser General Public
#     License along with this library; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
#     USA.
#
# /etc/init.d/hostapd
#   and its symbolic link
# /usr/sbin/rchostapd
#
### BEGIN INIT INFO
# Provides:          hostapd
# Required-Start:    $syslog $remote_fs
# Required-Stop:     $syslog $remote_fs
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: hostap deamon
# Description:       IEEE 802.11 access point and authenticator
### END INIT INFO

HOSTAPD_BIN=/usr/sbin/hostapd
HOSTAPD_PID=/var/run/hostapd.pid
HOSTAPD_ARGS="-B -P $HOSTAPD_PID"
HOSTAPD_CONF=/etc/hostapd.conf

sysconf=/etc/sysconfig/hostapd
if [ -e $sysconf ]; then
	. $sysconf
fi

. /etc/rc.status

rc_reset
case "$1" in
    start)
	echo -n "Starting hostapd "
	/sbin/start_daemon -p $HOSTAPD_PID $HOSTAPD_BIN $HOSTAPD_ARGS $HOSTAPD_CONF
	rc_status -v
	;;
    stop)
	echo -n "Shutting down hostapd "
	/sbin/killproc $HOSTAPD_BIN
	rc_status -v
	;;
    try-restart|condrestart)
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service hostapd "
	/sbin/killproc -HUP $HOSTAPD_BIN
	touch $HOSTAPD_PID
	rc_status -v
	;;
    reload)
	echo -n "Reload service hostapd "
	/sbin/killproc -HUP $HOSTAPD_BIN
	touch $HOSTAPD_PID
	rc_status -v
	;;
    status)
	echo -n "Checking for service hostapd "
	/sbin/checkproc $HOSTAPD_BIN
	rc_status -v
	;;
    probe)
	test $HOSTAPD_CONF -nt $HOSTAPD_PID && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
openSUSE Build Service is sponsored by