]> git.saurik.com Git - apple/mdnsresponder.git/blame - mDNSPosix/mdnsd.sh
mDNSResponder-1096.100.3.tar.gz
[apple/mdnsresponder.git] / mDNSPosix / mdnsd.sh
CommitLineData
8e92c31c 1#!/bin/sh
67c8f8a1 2# Emacs settings: -*- tab-width: 4 -*-
8e92c31c 3#
67c8f8a1 4# Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
8e92c31c 5#
67c8f8a1
A
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
8e92c31c 9#
67c8f8a1 10# http://www.apache.org/licenses/LICENSE-2.0
8e92c31c 11#
67c8f8a1
A
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
8e92c31c 16# limitations under the License.
67c8f8a1
A
17#
18# Linux /etc/init.d script to start/stop the mdnsd daemon.
8e92c31c 19#
8e92c31c
A
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
7f0064bd
A
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"
9f221bca 39 STOP="start-stop-daemon --stop --quiet --oknodo --retry 2 --exec"
8e92c31c
A
40else
41 killmdnsd() {
42 kill -TERM `cat /var/run/mdnsd.pid`
9f221bca 43 sleep 1
8e92c31c
A
44 }
45 START=
46 STOP=killmdnsd
47fi
48
49case "$1" in
50 start)
51 echo -n "Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
52 echo -n " mdnsd"
53 $START $DAEMON
54 echo "."
55 ;;
56 stop)
57 echo -n "Stopping Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
58 echo -n " mdnsd" ; $STOP $DAEMON
59 echo "."
60 ;;
61 reload|restart|force-reload)
62 echo -n "Restarting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
63 $STOP $DAEMON
8e92c31c
A
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