--- /dev/null
+#!/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" <kontakt@pbern.biz>
+
+
+# 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