3
# TiMidity /etc/init.d/ initscript for TiMidity++
4
# $Id: timidity.init,v 1.6 2004/09/30 01:04:04 hmh Exp $
6
# Copyright (c) 2004 by Henrique M. Holschuh <hmh@debian.org>
7
# Copyright (c) 2007-2009 Joost Yervante Damad <andete@debian.org>
9
# Distributed under the GPL version 2
14
# Required-Start: $remote_fs
15
# Required-Stop: $remote_fs
16
# Default-Start: 2 3 4 5
18
# Short-Description: start and stop timidity
19
# Description: TiMidity++ is a very high quality software-only MIDI sequencer
23
. /lib/lsb/init-functions
26
PATH=/sbin:/bin:/usr/sbin:/usr/bin
27
DAEMON=/usr/bin/${NAME}
28
DESC="TiMidity++ ALSA midi emulation"
29
PIDFILE=/var/run/timidity/${NAME}.pid
33
test -x ${DAEMON} || exit 0
36
TIM_ALSASEQPARAMS="-B2,8"
37
[ -r /etc/default/timidity ] && . /etc/default/timidity
38
if [ "${TIM_ALSASEQ}" != "true" ]; then
39
log_daemon_msg "Starting" "${NAME}"
40
log_daemon_msg " (to get timidity as an ALSA Sequencer enable this by editing the file /etc/default/timidity)"
45
[ -z "$SERVER_USER" ] && SERVER_USER=timidity
46
[ -z "$SERVER_GROUP" ] && SERVER_GROUP=timidity
48
if ! getent passwd | grep -q "^${SERVER_USER}:"; then
49
log_daemon_msg "Server user does not exist. Aborting"
53
if ! getent group | grep -q "^${SERVER_GROUP}:" ; then
54
log_daemon_msg "Server group does not exist. Aborting"
59
PARAMS="${TIM_ALSASEQPARAMS} -iAD"
62
START="--start --chuid ${SERVER_USER} --quiet --exec ${DAEMON} --pidfile ${PIDFILE} -- ${PARAMS}"
66
#log_daemon_msg "Starting" "${NAME}"
67
[ -d /proc/asound ] && [ -d /dev/snd/ ] || {
68
log_end_msg 1 || echo -n
69
log_warning_msg "ALSA is not active, cannot start $DESC"
72
log_begin_msg "Starting $DESC..."
73
mkdir -p /var/run/timidity
74
chown timidity /var/run/timidity
75
if start-stop-daemon ${START} >/dev/null; then
83
log_begin_msg "Stopping $DESC..."
84
if start-stop-daemon --stop --quiet --oknodo --pidfile ${PIDFILE} \
85
--name ${NAME} --retry 10 ; then
97
status_of_proc $DAEMON $NAME
100
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2