#!/bin/sh
### BEGIN INIT INFO
# Provides:          mrd6
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Short-Description: IPv6 Multicast Routing Daemon
# Description:       mrd6 is a IPv6 IPv6 Multicast Routing Daemon which 
#                    implements: MLDv1, MLDv2, PIM-SM, partial MBGP support, 
#                    Native and virtual (tunnel) interfaces support and CLI 
#                    support.
### END INIT INFO

# Author: Hugo Santos <hugo@fivebits.net>

PATH=/usr/sbin:/usr/bin:/sbin:/bin
DAEMON=/usr/sbin/mrd6
NAME=mrd6
DESC="Multicast routing daemon"
CONF=/etc/mrd6.conf

test -x $DAEMON || exit 0

test -r $CONF || exit 0

. /lib/lsb/init-functions

case "$1" in
  start)
    log_begin_msg "Starting $DESC: $NAME"
    start-stop-daemon --start --quiet -m --pidfile /var/run/mrd6.pid --exec $DAEMON -- -D
    log_end_msg $?
    ;;
  stop)
    log_begin_msg "Stopping $DESC: $NAME"
    start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
    rm -f /var/run/mrd6.pid
    log_end_msg $?
    ;;
  status)
    status_of_proc $DAEMON "$DESC: $NAME"
    ;;
  restart|force-reload)
    invoke-rc.d $NAME stop
    invoke-rc.d $NAME start
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

