]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSPosix/mdnsd.sh
mDNSResponder-171.4.tar.gz
[apple/mdnsresponder.git] / mDNSPosix / mdnsd.sh
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 # $Log: mdnsd.sh,v $
21 # Revision 1.9 2006/09/05 20:00:14 cheshire
22 # Moved Emacs settings to second line of file
23 #
24 # Revision 1.8 2006/08/29 16:42:01 mkrochma
25 # Fix POSIX startup script
26 #
27 # Revision 1.7 2006/08/14 23:24:47 cheshire
28 # Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
29 #
30 # Revision 1.6 2004/12/07 20:30:45 cheshire
31 # Fix start-stop-daemon for Suse Linux (don't use -s TERM)
32 #
33 # Revision 1.5 2004/06/29 22:13:45 cheshire
34 # Fix from Andrew White at NICTA
35 #
36 # Revision 1.4 2004/02/05 20:23:10 cheshire
37 # Fix mdnsd.sh to work on *BSD distributions
38 #
39 # Revision 1.3 2004/01/19 22:47:17 cheshire
40 # Define killprocterm() to do "killproc $1 -TERM" for Linux
41 #
42 # Revision 1.2 2003/12/11 19:42:13 cheshire
43 # Change name "mDNSResponderd" to "mdnsd" for consistency with standard Linux (Unix) naming conventions
44 #
45 # Revision 1.1 2003/12/08 20:47:02 rpantos
46 # Add support for mDNSResponder on Linux.
47 #
48 # The following lines are used by the *BSD rcorder system to decide
49 # the order it's going to run the rc.d scripts at startup time.
50 # PROVIDE: mdnsd
51 # REQUIRE: NETWORKING
52
53 if [ -r /usr/sbin/mdnsd ]; then
54 DAEMON=/usr/sbin/mdnsd
55 else
56 DAEMON=/usr/local/sbin/mdnsd
57 fi
58
59 test -r $DAEMON || exit 0
60
61 # Some systems have start-stop-daemon, some don't.
62 if [ -r /sbin/start-stop-daemon ]; then
63 START="start-stop-daemon --start --quiet --exec"
64 # Suse Linux doesn't work with symbolic signal names, but we really don't need
65 # to specify "-s TERM" since SIGTERM (15) is the default stop signal anway
66 # STOP="start-stop-daemon --stop -s TERM --quiet --oknodo --exec"
67 STOP="start-stop-daemon --stop --quiet --oknodo --exec"
68 else
69 killmdnsd() {
70 kill -TERM `cat /var/run/mdnsd.pid`
71 }
72 START=
73 STOP=killmdnsd
74 fi
75
76 case "$1" in
77 start)
78 echo -n "Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
79 echo -n " mdnsd"
80 $START $DAEMON
81 echo "."
82 ;;
83 stop)
84 echo -n "Stopping Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
85 echo -n " mdnsd" ; $STOP $DAEMON
86 echo "."
87 ;;
88 reload|restart|force-reload)
89 echo -n "Restarting Apple Darwin Multicast DNS / DNS Service Discovery daemon:"
90 $STOP $DAEMON
91 sleep 1
92 $START $DAEMON
93 echo -n " mdnsd"
94 ;;
95 *)
96 echo "Usage: /etc/init.d/mDNS {start|stop|reload|restart}"
97 exit 1
98 ;;
99 esac
100
101 exit 0