Moderator: moderators
rivangom wrote:Hi Gamezonline, did you manage to do something on the Autostart script? If so, can you please share. This is highly appreciated.
Many thanks.
Regards,
Robbert van Gom Neumann
#!/bin/sh
###################################################################################
# Shell script for starting Subsonic. See http://subsonic.org.
#
# Author: Sindre Mehus
###################################################################################
SUBSONIC_HOME=/var/subsonic/standalone
SUBSONIC_HOST=192.168.1.2
SUBSONIC_PORT=4040
SUBSONIC_HTTPS_PORT=4041
SUBSONIC_CONTEXT_PATH=/
SUBSONIC_MAX_MEMORY=100
SUBSONIC_PIDFILE=
SUBSONIC_DEFAULT_MUSIC_FOLDER=/Volume1/music
SUBSONIC_DEFAULT_PODCAST_FOLDER=/Volume1/music/Podcast
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/Volume1/playlists
quiet=0
usage() {
echo "Usage: subsonic.sh [options]"
echo " --help This small usage guide."
echo " --home=DIR The directory where Subsonic will create files."
echo " Make sure it is writable. Default: /var/subsonic"
echo " --host=HOST The host name or IP address on which to bind Subsonic."
echo " Only relevant if you have multiple network interfaces and want"
echo " to make Subsonic available on only one of them. The default value"
echo " will bind Subsonic to all available network interfaces. Default: 0.0.0.0"
echo " --port=PORT The port on which Subsonic will listen for"
echo " incoming HTTP traffic. Default: 4040"
echo " --https-port=PORT The port on which Subsonic will listen for"
echo " incoming HTTPS traffic. Default: 0 (disabled)"
echo " --context-path=PATH The context path, i.e., the last part of the Subsonic"
echo " URL. Typically '/' or '/subsonic'. Default '/'"
echo " --max-memory=MB The memory limit (max Java heap size) in megabytes."
echo " Default: 100"
echo " --pidfile=PIDFILE Write PID to this file. Default not created."
echo " --quiet Don't print anything to standard out. Default false."
echo " --default-music-folder=DIR Configure Subsonic to use this folder for music. This option "
echo " only has effect the first time Subsonic is started. Default '/var/music'"
echo " --default-podcast-folder=DIR Configure Subsonic to use this folder for Podcasts. This option "
echo " only has effect the first time Subsonic is started. Default '/var/music/Podcast'"
echo " --default-playlist-folder=DIR Configure Subsonic to use this folder for playlists. This option "
echo " only has effect the first time Subsonic is started. Default '/var/playlists'"
exit 1
}
# Parse arguments.
while [ $# -ge 1 ]; do
case $1 in
--help)
usage
;;
--home=?*)
SUBSONIC_HOME=${1#--home=}
;;
--host=?*)
SUBSONIC_HOST=${1#--host=}
;;
--port=?*)
SUBSONIC_PORT=${1#--port=}
;;
--https-port=?*)
SUBSONIC_HTTPS_PORT=${1#--https-port=}
;;
--context-path=?*)
SUBSONIC_CONTEXT_PATH=${1#--context-path=}
;;
--max-memory=?*)
SUBSONIC_MAX_MEMORY=${1#--max-memory=}
;;
--pidfile=?*)
SUBSONIC_PIDFILE=${1#--pidfile=}
;;
--quiet)
quiet=1
;;
--default-music-folder=?*)
SUBSONIC_DEFAULT_MUSIC_FOLDER=${1#--default-music-folder=}
;;
--default-podcast-folder=?*)
SUBSONIC_DEFAULT_PODCAST_FOLDER=${1#--default-podcast-folder=}
;;
--default-playlist-folder=?*)
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=${1#--default-playlist-folder=}
;;
*)
usage
;;
esac
shift
done
# Use JAVA_HOME if set, otherwise assume java is in the path.
JAVA=/usr/java/jre1.6.0_26/bin/java
if [ -e "${JAVA_HOME}" ]
then
JAVA=${JAVA_HOME}/bin/java
fi
# Create Subsonic home directory.
mkdir -p ${SUBSONIC_HOME}
LOG=${SUBSONIC_HOME}/subsonic_sh.log
rm -f ${LOG}
cd $(dirname $0)
if [ -L $0 ] && ([ -e /bin/readlink ] || [ -e /usr/bin/readlink ]); then
cd $(dirname $(readlink $0))
fi
${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
-Dsubsonic.home=${SUBSONIC_HOME} \
-Dsubsonic.host=${SUBSONIC_HOST} \
-Dsubsonic.port=${SUBSONIC_PORT} \
-Dsubsonic.httpsPort=${SUBSONIC_HTTPS_PORT} \
-Dsubsonic.contextPath=${SUBSONIC_CONTEXT_PATH} \
-Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
-Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
-Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
-Djava.awt.headless=true \
-jar subsonic-booter-jar-with-dependencies.jar > ${LOG} 2>&1 &
# Write pid to pidfile if it is defined.
if [ $SUBSONIC_PIDFILE ]; then
echo $! > ${SUBSONIC_PIDFILE}
fi
if [ $quiet = 0 ]; then
echo Started Subsonic [PID $!, ${LOG}]
fi
Synology> dd bs=32k count=1 if='/usr/syno/etc/rc.d/S99Subsonic.sh' skip=0
#!/bin/sh
subsonic_start() {
if [ "$(ps |grep java | grep subsonic | grep -v grep)" > /dev/null ]; then
echo "Subsonic already running, use restart instead"
else
echo "Starting subsonic..."
sh /var/subsonic/standalone/subsonic.sh
fi
}
subsonic_stop() {
echo "Stopping subsonic..."
kill -9 $(ps | grep java | grep subsonic | awk '{print $1}')
}
subsonic_restart() {
subsonic_stop
sleep 1
subsonic_start
}
case "$1" in
'start')
subsonic_start
;;
'stop')
subsonic_stop
;;
'restart')
subsonic_restart
;;
*)
subsonic_start
esac
chmod 777 /var/subsonic/standalone/subsonic.sh
chmod 777 /usr/syno/etc/rc.d/S99Subsonic.sh
stanthewizzard wrote:OMG
I really don't know how to do all that
1° I don't have ipkg installation.
2° I don't know how to make a symbolic link
I'm new to linux
BTW
on the Syno ... subsonic crash almost alway. Do you have the pb to ??
Many thanks
kill -9 $(ps | grep java | grep subsonic | awk '{print $1}')
gigon wrote:thanks gamezonline for the
- Code: Select all
kill -9 $(ps | grep java | grep subsonic | awk '{print $1}')
my old kill code were 3 lines with an if...
I have copied this to my start-stop-status script in the .spk Synology package file I am working on.
I have also made a x86 version but can't test it, so it would be nice if somebody can test if transcoding works.
Infos at http://www.eg-blog.de
Users browsing this forum: No registered users and 4 guests