mumble/mumble-server.init

78 lines
1.5 KiB
Bash

#! /bin/bash
#
### BEGIN INIT INFO
# Provides: mumble-server
# Required-Start: $network $local_fs $remote_fs dbus
# Required-Stop: $network $local_fs $remote_fs dbus
# Should-Start: mysql
# Should-Stop: mysql
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Mumble VoIP Server
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=mumble-server
PIDDIR=/var/run/$NAME
PIDFILE=$PIDDIR/$NAME.pid
DAEMON=/usr/sbin/murmurd
USER=mumble-server
GROUP=mumble-server
INIFILE=/etc/mumble-server.ini
DAEMON_OPTS="-ini $INIFILE"
# Include murmur defaults if available
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi
. /etc/rc.status
case "$1" in
start)
echo -n "Starting $NAME "
test -d $PIDDIR || /usr/bin/install -d -m 0755 -o mumble-server -g mumble-server $PIDDIR
/sbin/start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
rc_status -v
;;
stop)
echo -n "Shutting down $NAME "
killproc -p $PIDFILE -TERM $DAEMON
rc_status -v
;;
try-restart|condrestart)
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
$0 try-restart
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for service $NAME "
/sbin/checkproc $DAEMON
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
rc_exit