I still have problems with autostart of subsonic.sh in OpenSuse 11.2
Can't find where to put the startup routine.. And there is no (/etc/rc.local)
Anybody.. pls..
Moderator: moderators
# /etc/init.d/subsonic
#
# System startup/shutdown script for subsonic
#
### BEGIN INIT INFO
# Provides: subsonic
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: dbus $named
# Should-Stop: $portmap
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Subsonic media streamer daemon
# Description: Subsonic media streamer daemon
### END INIT INFO
# Source SuSE config, only if exists with size greater zero
test -s /etc/rc.config && \
. /etc/rc.config
test -s /etc/rc.status && \
. /etc/rc.status
# Load default settings (make changes in /etc/sysconfig/subsonic)
SUBSONIC_USER=subsonic
SUBSONIC_HOME=/var/subsonic
SUBSONIC_HOST=0.0.0.0
SUBSONIC_PORT=8080
SUBSONIC_CONTEXT_PATH=/
SUBSONIC_MAX_MEMORY=64
SUBSONIC_PIDFILE=/var/run/subsonic.pid
SUBSONIC_DEFAULT_MUSIC_FOLDER=/mnt/music
SUBSONIC_DEFAULT_PODCAST_FOLDER=/var/music/Podcast
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/mnt/music/playlists
SUBSONIC_LOG=/var/log/subsonic.log
JAVA=java
if [ -e "${JAVA_HOME}" ]
then
JAVA=${JAVA_HOME}/bin/java
fi
test -s /etc/sysconfig/subsonic && \
. /etc/sysconfig/subsonic
# This is the java command line we use to start subsonic
JAVA_COMMAND_LINE="${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m
-Dsubsonic.home=${SUBSONIC_HOME} \
-Dsubsonic.host=${SUBSONIC_HOST} \
-Dsubsonic.port=${SUBSONIC_PORT} \
-Dsubsonic.contextPath=${SUBSONIC_CONTEXT_PATH} \
-Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
-Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
-Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} -jar subsonic-booter-jar-with-dependencies.jar"
# First reset status of this service
rc_reset
# Make a list of currently-running processes for this user
# grep through them for ones that appear to be subsonic
# (they start with the Java command line and contain the phrase
# "subsonic.home"); getting PID list by removing else from ps
# output. This will obviously not included any processes we start
# here. We use this to make sure subsonic isn't already running,
# to decide what processes to kill, and to display status.
SUBSONIC_PIDS=`ps -u $SUBSONIC_USER -o pid= -wwo args= | \
grep -e "$JAVA_HOME.*subsonic\.home.*" | \
sed "s/ *\([0-9][0-9]*\) .*/\1/"`
case "$1" in
start)
echo -n "Starting subsonic (as user $SUBSONIC_USER)"
# Don't start Subsonic if it's already running
if [ -n "$SUBSONIC_PIDS" ] ; then
echo -e "\\nSubsonic appears to already be running as user $SUBSONIC_USER with PID(s) $SUBSONIC_PIDS."
rc_failed 1
else
# Ensure effective user can write to logfile by giving ownership
if [ -n "$SUBSONIC_LOG" ] ; then
touch "$SUBSONIC_LOG"
chown $SUBSONIC_USER "$SUBSONIC_LOG"
echo "--------------------------------------" >> $SUBSONIC_LOG
echo `date`": Starting subsonic restart:" >> $SUBSONIC_LOG
fi
# sudo to effective user and run java command line from above
# to start subsonic.
sudo -b -u $SUBSONIC_USER sh -c \
"cd $SUBSONIC_HOME; \
$JAVA_COMMAND_LINE >> ${SUBSONIC_LOG} 2>&1 &"
# These versions attempted to get PID written to file --
# Haven't figured out how to do it w/sudo yet...
# $JAVA_COMMAND_LINE >> ${SUBSONIC_LOG} 2>&1 & \
# [ -n "$SUBSONIC_PIDFILE" ] && echo $! > ${SUBSONIC_PIDFILE}"
# Remember status and be verbose
fi
rc_status -v
;;
stop)
echo -n "Shutting down subsonic... "
if [ -n "$SUBSONIC_PIDS" ] ; then
echo -n "killing pid(s)"
for subpid in $SUBSONIC_PIDS ; do
echo -n " $subpid"
kill -TERM $subpid
done
echo -n .
else
echo -n "No subsonic java process found."
fi
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
if [ -n "$SUBSONIC_PIDS" ] ; then
echo -n "Subsonic apparently running w/user $SUBSONIC_USER, pid(s): $SUBSONIC_PIDS."
else
echo "No Subsonic java process found running as user $SUBSONIC_USER."
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
SUBSONIC_USER=subsonic
SUBSONIC_HOME=/var/subsonic
SUBSONIC_HOST=0.0.0.0
SUBSONIC_PORT=8080
SUBSONIC_CONTEXT_PATH=/
SUBSONIC_MAX_MEMORY=64
#PID file not currently used
SUBSONIC_PIDFILE=/var/run/subsonic.pid
SUBSONIC_DEFAULT_MUSIC_FOLDER=/var/music
SUBSONIC_DEFAULT_PODCAST_FOLDER=/var/music/podcast
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/var/music/playlists
Users browsing this forum: No registered users and 54 guests