#!/bin/sh

##
# Multi-cast DNS Responder
##

. /etc/rc.common

StartService ()
{

    ## 
    # Startup the Multi-cast DNS Responder if it is available on the system
    ##
    if [ -f /usr/sbin/mDNSResponder ]; then
        if pid=$(GetPID mDNSResponder); then
            return 0
        else
            ConsoleMessage "Starting Apple Multicast DNS Responder"
            /usr/sbin/mDNSResponder
        fi
    fi
}

StopService ()
{
    if pid=$(GetPID mDNSResponder); then
	ConsoleMessage "Stopping Apple Multicast DNS Responder"
	kill -TERM "${pid}"
    else
	ConsoleMessage "Apple Multicast DNS Responder is not running."
    fi
}

RestartService () { StopService; StartService; }

RunService "$1"
