]>
Commit | Line | Data |
---|---|---|
8e92c31c A |
1 | #!/bin/sh |
2 | # | |
c9d2d929 A |
3 | # Linux /etc/init.d script to start/stop the mdnsd daemon. |
4 | # Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved. | |
8e92c31c | 5 | # |
c9d2d929 | 6 | # @APPLE_LICENSE_HEADER_START@ |
8e92c31c | 7 | # |
c9d2d929 A |
8 | # This file contains Original Code and/or Modifications of Original Code |
9 | # as defined in and that are subject to the Apple Public Source License | |
10 | # Version 2.0 (the 'License'). You may not use this file except in | |
11 | # compliance with the License. Please obtain a copy of the License at | |
12 | # http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | # file. | |
8e92c31c | 14 | # |
c9d2d929 A |
15 | # The Original Code and all software distributed under the License are |
16 | # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
17 | # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
18 | # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
19 | # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
20 | # Please see the License for the specific language governing rights and | |
8e92c31c | 21 | # limitations under the License. |
c9d2d929 A |
22 | # |
23 | # @APPLE_LICENSE_HEADER_END@ | |
8e92c31c A |
24 | # |
25 | # $Log: mdnsd.sh,v $ | |
7f0064bd A |
26 | # Revision 1.6 2004/12/07 20:30:45 cheshire |
27 | # Fix start-stop-daemon for Suse Linux (don't use -s TERM) | |
28 | # | |
29 | # Revision 1.5 2004/06/29 22:13:45 cheshire | |
30 | # Fix from Andrew White at NICTA | |
31 | # | |
8e92c31c A |
32 | # Revision 1.4 2004/02/05 20:23:10 cheshire |
33 | # Fix mdnsd.sh to work on *BSD distributions | |
34 | # | |
8e92c31c A |
35 | # Revision 1.3 2004/01/19 22:47:17 cheshire |
36 | # Define killprocterm() to do "killproc $1 -TERM" for Linux | |
37 | # | |
38 | # Revision 1.2 2003/12/11 19:42:13 cheshire | |
39 | # Change name "mDNSResponderd" to "mdnsd" for consistency with standard Linux (Unix) naming conventions | |
40 | # | |
41 | # Revision 1.1 2003/12/08 20:47:02 rpantos | |
42 | # Add support for mDNSResponder on Linux. | |
43 | # | |
44 | # The following lines are used by the *BSD rcorder system to decide | |
45 | # the order it's going to run the rc.d scripts at startup time. | |
46 | # PROVIDE: mdnsd | |
47 | # REQUIRE: NETWORKING | |
48 | ||
49 | if [ -r /usr/sbin/mdnsd ]; then | |
50 | DAEMON=/usr/sbin/mdnsd | |
51 | else | |
52 | DAEMON=/usr/local/sbin/mdnsd | |
53 | fi | |
54 | ||
55 | test -r $DAEMON || exit 0 | |
56 | ||
57 | # Some systems have start-stop-daemon, some don't. | |
58 | if [ -r /sbin/start-stop-daemon ]; then | |
7f0064bd A |
59 | START="start-stop-daemon --start --quiet --exec" |
60 | # Suse Linux doesn't work with symbolic signal names, but we really don't need | |
61 | # to specify "-s TERM" since SIGTERM (15) is the default stop signal anway | |
62 | # STOP="start-stop-daemon --stop -s TERM --quiet --oknodo --exec" | |
63 | STOP="start-stop-daemon --stop --quiet --oknodo --exec" | |
8e92c31c A |
64 | else |
65 | killmdnsd() { | |
66 | kill -TERM `cat /var/run/mdnsd.pid` | |
67 | } | |
68 | START= | |
69 | STOP=killmdnsd | |
70 | fi | |
71 | ||
72 | case "$1" in | |
73 | start) | |
74 | echo -n "Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:" | |
75 | echo -n " mdnsd" | |
76 | $START $DAEMON | |
77 | echo "." | |
78 | ;; | |
79 | stop) | |
80 | echo -n "Stopping Apple Darwin Multicast DNS / DNS Service Discovery daemon:" | |
81 | echo -n " mdnsd" ; $STOP $DAEMON | |
82 | echo "." | |
83 | ;; | |
84 | reload|restart|force-reload) | |
85 | echo -n "Restarting Apple Darwin Multicast DNS / DNS Service Discovery daemon:" | |
86 | $STOP $DAEMON | |
87 | sleep 1 | |
88 | $START $DAEMON | |
89 | echo -n " mdnsd" | |
90 | ;; | |
91 | *) | |
92 | echo "Usage: /etc/init.d/mDNS {start|stop|reload|restart}" | |
93 | exit 1 | |
94 | ;; | |
95 | esac | |
96 | ||
97 | exit 0 |