Convert most DEBUG level messages to INFO level
[wifi-radar.git] / debian / wifi-radar.init
blobcaeebab2e8d37a5be480a6a81f291d04ee81d67c
1 #!/bin/bash
3 # Start or stop wifi-radar daemon.
5 # Written by Ante Karamatic <ivoks@grad.hr>
7 PATH=/bin:/usr/bin:/sbin:/usr/sbin
8 WR_BIN="/usr/sbin/wifi-radar"
9 ETH=`grep interface /etc/wifi-radar.conf 2>/dev/null | cut -d' ' -f3 2>/dev/null`
10 PIDFILE="/var/run/wifi-radar-daemon.pid"
11 DHCP_PID=`cat /var/run/dhcpcd-wifi.pid 2>/dev/null`
13 . /lib/lsb/init-functions
15 case "${1}" in
16 ("start")
17 log_begin_msg "Starting wifi-radar daemon..."
18 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec "${WR_BIN}" -- -d >/dev/null 2>&1 &
19 exit $?
21 ("stop")
22 log_begin_msg "Stopping wifi-radar daemon..."
23 start-stop-daemon --stop --retry=1 --pidfile $PIDFILE --quiet --exec "${WR_BIN}" >/dev/null 2>&1
24 kill -9 $DHCP_PID >/dev/null 2>&1
25 ifconfig "${ETH}" down >/dev/null 2>&1
26 exit $?
28 ("restart")
29 "${0}" stop
30 "${0}" start
32 (*)
33 log_success_msg "Usage: /etc/init.d/wifi-radar {start|stop|restart}" >&2
34 exit 3
36 esac