~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/avahi-dnsconfd

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
### BEGIN INIT INFO
3
 
# Provides:          avahi-dnsconfd
4
 
# Required-Start:    $remote_fs avahi-daemon
5
 
# Required-Stop:     $remote_fs avahi-daemon
6
 
# Should-Start:      $syslog
7
 
# Should-Stop:       $syslog
8
 
# Default-Start:     2 3 4 5
9
 
# Default-Stop:      0 1 6
10
 
# Short-Description: Avahi Unicast DNS Configuration Daemon
11
 
# Description:       A DNS configuration daemon using mDNS in a
12
 
#                    DHCP-like fashion
13
 
### END INIT INFO
14
 
 
15
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin
16
 
DESC="Avahi Unicast DNS Configuration Daemon"
17
 
NAME="avahi-dnsconfd"
18
 
DAEMON="/usr/sbin/$NAME"
19
 
SCRIPTNAME=/etc/init.d/$NAME
20
 
 
21
 
# Gracefully exit if the package has been removed.
22
 
test -x $DAEMON || exit 0
23
 
 
24
 
. /lib/lsb/init-functions
25
 
 
26
 
#
27
 
#       Function that starts the daemon/service.
28
 
#
29
 
d_start() {
30
 
    $DAEMON -c && return 0
31
 
 
32
 
    if [ -s /etc/localtime ]; then
33
 
        if [ ! -d /etc/avahi/etc ]; then
34
 
            mkdir -p /etc/avahi/etc >/dev/null 2>&1
35
 
        fi
36
 
        cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
37
 
    fi;
38
 
 
39
 
    $DAEMON -D
40
 
}
41
 
 
42
 
#
43
 
#       Function that stops the daemon/service.
44
 
#
45
 
d_stop() {
46
 
    if $DAEMON -c ; then
47
 
       $DAEMON -k
48
 
    fi
49
 
}
50
 
 
51
 
#
52
 
#       Function that reload the config file for the daemon/service.
53
 
#
54
 
d_refresh() {
55
 
    $DAEMON -c && $DAEMON -r
56
 
}
57
 
 
58
 
#
59
 
#       Function that check the status of the daemon/service.
60
 
#
61
 
d_status() {
62
 
    $DAEMON -c && { echo "$DESC is running"; exit 0; } || { echo "$DESC is not running"; exit 3; }
63
 
}
64
 
 
65
 
case "$1" in
66
 
    start)
67
 
        log_daemon_msg "Starting $DESC" "$NAME"
68
 
        d_start
69
 
        log_end_msg $?
70
 
        ;;
71
 
    stop)
72
 
        log_daemon_msg "Stopping $DESC" "$NAME"
73
 
        d_stop
74
 
        log_end_msg $?
75
 
        ;;
76
 
    refresh)
77
 
        log_daemon_msg "Refreshing $DESC" "$NAME"
78
 
        d_refresh
79
 
        log_end_msg $?
80
 
        ;;
81
 
    restart|force-reload)
82
 
        log_daemon_msg "Restarting $DESC" "$NAME"
83
 
        d_stop
84
 
        if [ "$?" -eq 0 ]; then
85
 
                d_start
86
 
                log_end_msg $?
87
 
        else
88
 
                log_end_msg 1
89
 
        fi
90
 
        ;;
91
 
    status)
92
 
        d_status
93
 
        ;;
94
 
    *)
95
 
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|refresh|status}" >&2
96
 
        exit 3
97
 
        ;;
98
 
esac
99
 
 
100
 
exit 0