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