I have rewritten the init script included in the RPM to work with the init system of openSuSE 11.2:
- Code: Select all
#!/bin/bash
#
# subsonic This shell script takes care of starting and stopping Subsonic
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: subsonic
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Subsonic daemon
# Description: Starts the Subsonic daemon. Subsonic is a web-based
# music streamer, jukebox and Podcast receiver.
# See http://subsonic.org for more details.
### END INIT INFO
# Author: Sindre Mehus <sindre@activeobjects.no>
# To change the startup parameters of Subsonic, modify the service
# configuration file /etc/sysconfig/subsonic rather than this file.
[ -r /etc/sysconfig/subsonic ] && . /etc/sysconfig/subsonic
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Subsonic Daemon"
NAME=subsonic
PIDFILE=/var/run/$NAME.pid
LOCKFILE=/var/lock/subsys/$NAME
## Need to check for java bin in checkproc/killproc not subsonic
BIN=/usr/bin/java
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="--pidfile=$PIDFILE $SUBSONIC_ARGS"
SCRIPTNAME=/etc/init.d/$NAME
## Source rc.status and reset status
. /etc/rc.status
rc_reset
# Check for missing binary
if [ ! -x ${DAEMON} ]; then
echo -n >&2 "Subsonic daemon, ${DAEMON} is not installed. "
rc_status -s
exit 5
fi
#
# Function that starts the daemon/service
#
do_start()
{
# Check if daemon is already running.
checkproc -p ${PIDFILE} ${BIN}
case $? in
0) echo -n "- Warning: daemon already running. " ;;
1) echo -n "- Warning: ${PIDFILE} exists. " ;;
esac
echo $"Starting $NAME ..."
startproc -v -p ${PIDFILE} ${DAEMON} ${DAEMON_ARGS}
checkproc -p ${PIDFILE} ${BIN}
rc_status -v
}
#
# Function that stops the daemon/service
#
do_stop()
{
echo -n "Shutting down ${NAME} daemon "
checkproc -p ${PIDFILE} ${BIN} || \
echo -n " Warning: daemon not running. "
killproc -p ${PIDFILE} -t 10 ${BIN}
rc_status -v
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
echo -n "Checking for $NAME daemon "
checkproc -p ${PIDFILE} ${BIN}
rc_status -v
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac