#!/bin/sh # # Start/Stop the WiFi-Radar daemon # # Requirements: PyGTK+ 2, iwconfig # Author: Stijn "Borromini" Segers (stijn.zenwalk@gmail.com) # Modify by: Juan A. Moreno (juan@apuntale.com) # get the wifi interface from rc.inet1.conf if it is set . /etc/rc.d/rc.inet1.conf interface="${IFNAME[4]}" start() { # use the forced interface found in rc.inet1.conf or guess it if [ ! "$IFNAME_INET" ]; then interface="$(iwconfig 2>/dev/null | grep ESSID | head -n1 | cut -d " " -f 1)" if [ ! "$interface" ]; then echo "You dont have Wifi Card" exit 1 fi else $interface = $IFNAME_INET echo "Starting WiFi-Radar: " if [ -e /var/run/wifi.pid ]; then echo "/var/run/wifi.pid file exists! Remove it before starting" exit 1 fi /usr/sbin/wifi-radar --daemon ps -e | grep wifi-radar | cut -d" " -f2 > /var/run/wifi.pid fi } stop() { echo "Stopping WiFi-Radar: " killall -9 wifi-radar rm -f /var/run/wifi.pid } restart() { stop start } status() { if [ -e /var/run/wifi.pid ]; then echo "The WiFi-Radar daemon is running." else echo "The WiFi-Radar daemon is not running" fi } case "$1" in 'start') start ;; 'stop') stop ;; 'restart') restart ;; 'status') status ;; *) echo "Usage $0: start|stop|restart|status" esac