~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to etc/init.d/mumble-server

  • Committer: Dimitri John Ledkov
  • Date: 2014-05-06 18:45:46 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140506184546-5toyx56xxrue0f0v
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#
3
 
### BEGIN INIT INFO
4
 
# Provides:             mumble-server
5
 
# Required-Start:       $network $local_fs $remote_fs
6
 
# Required-Stop:        $network $local_fs $remote_fs
7
 
# Should-Start:         $mysql dbus
8
 
# Should-Stop:          $mysql dbus
9
 
# Default-Start:        2 3 4 5
10
 
# Default-Stop:         0 1 6
11
 
# Short-Description:    Mumble VoIP Server
12
 
# Description:          init script for the Mumble VoIP Server murmurd.
13
 
### END INIT INFO
14
 
 
15
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin
16
 
NAME=mumble-server
17
 
DESC="Mumble VoIP Server"
18
 
PIDDIR=/var/run/$NAME
19
 
PIDFILE=$PIDDIR/$NAME.pid
20
 
DAEMON=/usr/sbin/murmurd
21
 
USER=mumble-server
22
 
GROUP=mumble-server
23
 
 
24
 
test -x $DAEMON || exit 0
25
 
 
26
 
INIFILE=/etc/mumble-server.ini
27
 
DAEMON_OPTS="-ini $INIFILE"
28
 
MURMUR_DAEMON_START=0
29
 
MURMUR_USE_CAPABILITIES=0
30
 
MURMUR_LIMIT_NOFILE=0
31
 
 
32
 
# Include murmur defaults if available
33
 
if [ -f /etc/default/$NAME ] ; then
34
 
        . /etc/default/$NAME
35
 
fi
36
 
 
37
 
. /lib/init/vars.sh
38
 
. /lib/lsb/init-functions
39
 
 
40
 
if [ "$MURMUR_LIMIT_NOFILE" -gt 0 ] ; then
41
 
        ulimit -n $MURMUR_LIMIT_NOFILE
42
 
fi
43
 
 
44
 
case "$1" in
45
 
  start)
46
 
        if [ "$MURMUR_DAEMON_START" != "1" ] ; then
47
 
                log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME"
48
 
                exit 0
49
 
        fi
50
 
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
51
 
        [ -d $PIDDIR ] || install -o $USER -d $PIDDIR
52
 
        if [ "$MURMUR_USE_CAPABILITIES" != "1" ] ; then
53
 
          start-stop-daemon --start --quiet \
54
 
                --pidfile $PIDFILE \
55
 
                --chuid $USER:$GROUP \
56
 
                --exec $DAEMON \
57
 
                -- $DAEMON_OPTS
58
 
        else
59
 
          start-stop-daemon --start --quiet \
60
 
                --pidfile $PIDFILE \
61
 
                --exec $DAEMON \
62
 
                -- $DAEMON_OPTS
63
 
        fi
64
 
        case "$?" in
65
 
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
66
 
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
67
 
        esac
68
 
        ;;
69
 
  stop)
70
 
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
71
 
        start-stop-daemon --stop --quiet \
72
 
                --retry=TERM/30/KILL/5 \
73
 
                --pidfile $PIDFILE \
74
 
                --user $USER \
75
 
                --exec $DAEMON
76
 
        case "$?" in
77
 
                0|1)    rm -f $PIDFILE
78
 
                        [ "$VERBOSE" != no ] && log_end_msg 0
79
 
                        ;;
80
 
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
81
 
        esac
82
 
        ;;
83
 
  status)
84
 
        if start-stop-daemon --test --stop --quiet \
85
 
                --pidfile $PIDFILE \
86
 
                --user $USER \
87
 
                --exec $DAEMON
88
 
        then
89
 
                [ "$VERBOSE" != no ] && echo "$DESC is running."
90
 
                exit 0
91
 
        else
92
 
                [ "$VERBOSE" != no ] && echo "$DESC is not running"
93
 
                exit 3
94
 
        fi
95
 
        ;;
96
 
  force-reload)
97
 
        start-stop-daemon --stop --test --quiet \
98
 
                --pidfile $PIDFILE \
99
 
                --user $USER \
100
 
                --exec $DAEMON \
101
 
        && $0 restart || exit 0
102
 
        ;;
103
 
  restart)
104
 
        [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
105
 
        start-stop-daemon --stop --quiet \
106
 
                --retry=TERM/30/KILL/5 \
107
 
                --pidfile $PIDFILE \
108
 
                --user $USER \
109
 
                --exec $DAEMON
110
 
        case "$?" in
111
 
                0|1)
112
 
                        [ -d $PIDDIR ] || install -o $USER -d $PIDDIR
113
 
                        rm -f $PIDFILE
114
 
                        if [ "$MURMUR_USE_CAPABILITIES" != "1" ] ; then
115
 
                          start-stop-daemon --start --quiet \
116
 
                                --pidfile $PIDFILE \
117
 
                                --chuid $USER:$GROUP \
118
 
                                --exec $DAEMON \
119
 
                                -- $DAEMON_OPTS
120
 
                        else
121
 
                          start-stop-daemon --start --quiet \
122
 
                                --pidfile $PIDFILE \
123
 
                                --exec $DAEMON \
124
 
                                -- $DAEMON_OPTS
125
 
                        fi
126
 
                        case "$?" in
127
 
                                0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
128
 
                                *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
129
 
                        esac
130
 
                        ;;
131
 
                *)
132
 
                        [ "$VERBOSE" != no ] && log_end_msg 0
133
 
                        ;;
134
 
        esac
135
 
        ;;
136
 
  *)
137
 
        N=/etc/init.d/$NAME
138
 
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
139
 
        exit 3
140
 
        ;;
141
 
esac
142
 
 
143
 
exit 0