From: pbern Date: Sun, 28 Sep 2003 18:05:15 +0000 (+0000) Subject: - hostapd init X-Git-Tag: auto/ac/hostapd-0_2_2-1~9 X-Git-Url: https://git.pld-linux.org/?p=packages%2Fhostapd.git;a=commitdiff_plain;h=956463fe43558cd406eaf7523714efab92429d66 - hostapd init Changed files: hostapd.init -> 1.1 --- 956463fe43558cd406eaf7523714efab92429d66 diff --git a/hostapd.init b/hostapd.init new file mode 100644 index 0000000..f15ecee --- /dev/null +++ b/hostapd.init @@ -0,0 +1,67 @@ +#!/bin/sh +# +# hostapd This script is used to start and stop hostapd service +# +# chkconfig: 345 83 17 +# +# description: hostapd is a deamon to run wlan card based on prism2 +# chip as Access Point. +# +# Author: Pawel Bernadowski "pbern" + + +# Source function library +. /etc/rc.d/init.d/functions + +# Get network config +. /etc/sysconfig/network + +# Check that networkin is up +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down hostapd + exit 1 + fi +else + exit 0 +fi + +RETVAL=0 +# See how we were called. +case "$1" in + start) + # Check if the service is already running? + if [ ! -f /var/lock/subsys/hostapd ]; then + msg_starting hostapd + daemon /sbin/hostapd /etc/hostap/hostapd.conf -B + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hostapd + else + msg_already_running hostapd + fi + ;; + stop) + if [ -f /var/lock/subsys/hostapd ]; then + # Stop daemon + msg_stopping hostapd + killproc hostapd + rm -f /var/lock/subsys/hostapd >/dev/null 2>&1 + else + msg_not_running hostapd + fi + ;; + restart|force-reload) + $0 stop + $0 start + exit $? + ;; + status) + status hostapd + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|force-reload|status}" + exit 3 +esac + +exit $RETVAL