aboutsummaryrefslogtreecommitdiff
path: root/network/wifi-radar/rc.wifi-radar
diff options
context:
space:
mode:
authorDavid Somero <dsomero@hotmail.com>2010-05-11 20:01:46 +0200
committerAlan Hicks <alan@lizella.net>2010-05-11 20:01:46 +0200
commitca43bff4ec0b2f933ac58062447346adea901ca0 (patch)
tree78adbfe2822df0285643ff8f5f21f763ed0989b3 /network/wifi-radar/rc.wifi-radar
parent0f4d19b856480f56bfebc83cb94571c8e2992ec0 (diff)
network/wifi-radar: Added to 12.0 repository
Diffstat (limited to 'network/wifi-radar/rc.wifi-radar')
-rw-r--r--network/wifi-radar/rc.wifi-radar62
1 files changed, 62 insertions, 0 deletions
diff --git a/network/wifi-radar/rc.wifi-radar b/network/wifi-radar/rc.wifi-radar
new file mode 100644
index 0000000000000..014d9d9bd9ed6
--- /dev/null
+++ b/network/wifi-radar/rc.wifi-radar
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Start/Stop the WiFi-Radar daemon
+#
+
+# get the wifi interface from rc.inet1.conf if it is set
+. /etc/rc.d/rc.inet1.conf
+INTERFACE="${IFNAME[4]}"
+PIDFILE=/var/run/wifi.pid
+
+start() {
+ # use the forced interface found in rc.inet1.conf or guess it
+ [ ! "$INTERFACE" ] && INTERFACE="$(iwconfig 2>/dev/null | grep ESSID | head -n1 | cut -d " " -f 1)"
+ sed -i "s/^[ \t]*interface[ \t]*=[ \t]*.*/interface = $INTERFACE/" /etc/wifi-radar/wifi-radar.conf
+
+ if [ -e "${PIDFILE}" ]; then
+ echo "Found existing ${PIDFILE}! Stopping first before starting"
+ stop
+ fi
+ echo "Starting WiFi-Radar: "
+ /usr/sbin/wifi-radar --daemon 1> /dev/null 2> /dev/null &
+ ps -e | grep wifi-radar | cut -d" " -f2 > ${PIDFILE}
+}
+
+stop() {
+ echo "Stopping WiFi-Radar: "
+ if [ -e "${PIDFILE}" ]; then
+ kill $(cat ${PIDFILE}) 1> /dev/null 2> /dev/null
+ rm -f ${PIDFILE}
+ fi
+killall wifi-radar 1> /dev/null 2> /dev/null
+}
+
+restart() {
+ stop
+ sleep 2
+ start
+}
+
+status() {
+ if [ -e ${PIDFILE} ]; then
+ echo "The WiFi-Radar daemon is running."
+ else
+ echo "The WiFi-Radar daemon is not running"
+ fi
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ ;;
+esac