1#!/bin/bash
2
3# This file is part of avahi.
4#
5# avahi is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as
7# published by the Free Software Foundation; either version 2 of the
8# License, or (at your option) any later version.
9#
10# avahi is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13# License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with avahi; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18# USA.
19
20#
21# Authors:      <lathiat@bur.st>
22#
23
24
25# general config
26. /etc/rc.conf
27. /etc/rc.d/functions
28
29PATH=/sbin:/bin:/usr/sbin:/usr/bin
30DESC="Avahi mDNS/DNS-SD Daemon"
31NAME="avahi-daemon"
32DAEMON="@sbindir@/$NAME"
33
34case "$1" in
35    start)
36        stat_busy "Starting $DESC"
37        $DAEMON -D > /dev/null 2>&1
38        if [ $? -gt 0 ]; then
39            stat_fail
40        else
41            add_daemon $NAME
42            stat_done
43        fi
44        ;;
45    stop)
46        stat_busy "Stopping $DESC"
47        $DAEMON -k > /dev/null 2>&1
48        if [ $? -gt 0 ]; then
49            stat_fail
50        else
51            rm_daemon $NAME
52            stat_done
53        fi
54        ;;
55    restart)
56        $0 stop
57        $0 start
58        ;;
59    reload)
60        stat_busy "Reloading services for $DESC"
61        $DAEMON -r > /dev/null 2>&1
62        if [ $? -gt 0 ]; then
63            stat_fail
64        else
65            stat_done
66        fi
67        ;;
68    *)
69        echo "usage: $0 {start|stop|restart|reload}"
70	;;
71esac
72exit 0
73