• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# Emacs settings: -*- tab-width: 4 -*-
3#
4# Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# Linux /etc/init.d script to start/stop the mdnsd daemon.
19#
20# The following lines are used by the *BSD rcorder system to decide
21# the order it's going to run the rc.d scripts at startup time.
22# PROVIDE: mdnsd
23# REQUIRE: NETWORKING
24
25if [ -r /usr/sbin/mdnsd ]; then
26    DAEMON=/usr/sbin/mdnsd
27else
28    DAEMON=/usr/local/sbin/mdnsd
29fi
30
31test -r $DAEMON || exit 0
32
33# Some systems have start-stop-daemon, some don't.
34if [ -r /sbin/start-stop-daemon ]; then
35	START="start-stop-daemon --start --quiet --exec"
36	# Suse Linux doesn't work with symbolic signal names, but we really don't need
37	# to specify "-s TERM" since SIGTERM (15) is the default stop signal anway
38	# STOP="start-stop-daemon --stop -s TERM --quiet --oknodo --exec"
39	STOP="start-stop-daemon --stop --quiet --oknodo --exec"
40else
41	killmdnsd() {
42		kill -TERM `cat /var/run/mdnsd.pid`
43	}
44	START=
45	STOP=killmdnsd
46fi
47
48case "$1" in
49    start)
50	echo -n "Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
51	echo -n " mdnsd"
52        $START $DAEMON
53	echo "."
54	;;
55    stop)
56        echo -n "Stopping Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
57        echo -n " mdnsd" ; $STOP $DAEMON
58        echo "."
59	;;
60    reload|restart|force-reload)
61		echo -n "Restarting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
62		$STOP $DAEMON
63		sleep 1
64		$START $DAEMON
65		echo -n " mdnsd"
66	;;
67    *)
68	echo "Usage: /etc/init.d/mDNS {start|stop|reload|restart}"
69	exit 1
70	;;
71esac
72
73exit 0
74