Revert "Change default bssid from empty string to 00:00:00:00:00:00 string"
[wifi-radar.git] / init_script
blobe10a985eb6e27bcfdda24e107e8472c60f0e00c2
1 #!/bin/bash
3 # $Id$
5 # Start or stop wifi-radar in daemon mode.
7 # Written by Ante Karamatic <ivoks@grad.hr>
9 # Modified by Brian Elliott Finley <brian@thefinleys.com>
12 PATH=/bin:/usr/bin:/sbin:/usr/sbin
13 WR_BIN="/usr/sbin/wifi-radar"
14 ETH=`grep interface /etc/wifi-radar/wifi-radar.conf 2>/dev/null | cut -d' ' -f3 2>/dev/null`
15 PIDFILE="/var/run/wifi-radar-daemon.pid"
16 DHCP_PID=`cat /var/run/dhcpcd-wifi.pid 2>/dev/null`
18 . /lib/lsb/init-functions
20 case "${1}" in
21 ("start")
22 vpnc-disconnect >/dev/null 2>&1
23 log_begin_msg "Starting wifi-radar daemon..."
24 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec "${WR_BIN}" -- -d >/dev/null 2>&1 &
25 exit $?
27 ("stop")
28 log_begin_msg "Stopping wifi-radar daemon..."
29 start-stop-daemon --stop --retry=1 --pidfile $PIDFILE --quiet --exec "${WR_BIN}" >/dev/null 2>&1
30 kill -9 $DHCP_PID >/dev/null 2>&1
31 ifconfig "${ETH}" down >/dev/null 2>&1
32 exit $?
34 ("restart")
35 "${0}" stop
36 "${0}" start
38 (*)
39 log_success_msg "Usage: /etc/init.d/wifi-radar {start|stop|restart}" >&2
40 exit 3
42 esac