#!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2010 OpenWrt.org
+
START=99
-DEBUG=0
+STOP=10
+
+# igmpproxy supports both a debug mode and verbosity, which are very useful
+# when something isn't working.
+#
+# Debug mode will print everything to stdout instead of syslog. Generally
+# verbosity should NOT be set as it will quickly fill your syslog.
#
-# The debug flag should generally be set to 0
-# otherwise igmpproxy will spam your syslog.
-# However, this is very useful for debugging
-# a non-functional configuration file.
+# Put any debug or verbosity options into IGMP_OPTS
#
-# DEBUG=0 = NO DEBUG!!!
-# DEBUG=1 -d
-# DEBUG=2 -v
-# DEBUG=3 -v -v
-LOGFILE="/root/igmpproxy.log"
+# Examples:
+# IGMP_OPTS="-d -v -v" - debug mode and very verbose, this will land in
+# stdout and not in syslog
+# IGMP_OPTS="-v" - be verbose, this will write aditional information to syslog
+
+IGMP_OPTS=""
+IGMP_BIN="/usr/sbin/igmpproxy"
+IGMP_CNF="/etc/igmpproxy.conf"
+PID_F="/var/run/igmpproxy.pid"
+
start() {
- echo -n "Starting igmpproxy"
- # Normal Mode
- if [ $DEBUG -eq 0 ]; then
- echo " in normal mode"
- /usr/sbin/igmpproxy /etc/igmpproxy.conf &
- # Debug Mode
- elif [ $DEBUG -eq 1 ]; then
- echo " in debug mode"
- /usr/sbin/igmpproxy -d /etc/igmpproxy.conf &
- # Verbose Mode
- elif [ $DEBUG -eq 2 ]; then
- echo " in verbose mode"
- /usr/sbin/igmpproxy -v /etc/igmpproxy.conf &
- # Very Verbose Mode
- elif [ $DEBUG -eq 3 ]; then
- echo " in very verbose mode"
- /usr/sbin/igmpproxy -v -v /etc/igmpproxy.conf &
- else
- echo " unkown debug mode, must be 0, 1, 2 or 3"
- fi
+ echo "Starting igmpproxy"
+ start-stop-daemon -S -x $IGMP_BIN -p $PID_F -b -m -- $IGMP_OPTS $IGMP_CNF
}
stop() {
- echo "Killing igmpporxy"
- killall igmpproxy
+ echo "Stopping igmpporxy"
+ start-stop-daemon -K -x $IGMP_BIN -p $PID_F -q
}