3 ###################################################################################
4 # Shell script for starting Subsonic. See http://subsonic.org.
7 ###################################################################################
9 SUBSONIC_HOME
=/var
/subsonic
13 SUBSONIC_CONTEXT_PATH
=/
14 SUBSONIC_MAX_MEMORY
=100
16 SUBSONIC_DEFAULT_MUSIC_FOLDER
=/var
/music
17 SUBSONIC_DEFAULT_PODCAST_FOLDER
=/var
/music
/Podcast
18 SUBSONIC_DEFAULT_PLAYLIST_FOLDER
=/var
/playlists
19 JAVA_HOME
=/opt
/java
/jre
24 echo "Usage: subsonic.sh [options]"
25 echo " --help This small usage guide."
26 echo " --home=DIR The directory where Subsonic will create files."
27 echo " Make sure it is writable. Default: /var/subsonic"
28 echo " --host=HOST The host name or IP address on which to bind Subsonic."
29 echo " Only relevant if you have multiple network interfaces and want"
30 echo " to make Subsonic available on only one of them. The default value"
31 echo " will bind Subsonic to all available network interfaces. Default: 0.0.0.0"
32 echo " --port=PORT The port on which Subsonic will listen for"
33 echo " incoming HTTP traffic. Default: 4040"
34 echo " --https-port=PORT The port on which Subsonic will listen for"
35 echo " incoming HTTPS traffic. Default: 0 (disabled)"
36 echo " --context-path=PATH The context path, i.e., the last part of the Subsonic"
37 echo " URL. Typically '/' or '/subsonic'. Default '/'"
38 echo " --max-memory=MB The memory limit (max Java heap size) in megabytes."
40 echo " --pidfile=PIDFILE Write PID to this file. Default not created."
41 echo " --quiet Don't print anything to standard out. Default false."
42 echo " --default-music-folder=DIR Configure Subsonic to use this folder for music. This option "
43 echo " only has effect the first time Subsonic is started. Default '/var/music'"
44 echo " --default-podcast-folder=DIR Configure Subsonic to use this folder for Podcasts. This option "
45 echo " only has effect the first time Subsonic is started. Default '/var/music/Podcast'"
46 echo " --default-playlist-folder=DIR Configure Subsonic to use this folder for playlists. This option "
47 echo " only has effect the first time Subsonic is started. Default '/var/playlists'"
52 while [ $# -ge 1 ]; do
58 SUBSONIC_HOME
=${1#--home=}
61 SUBSONIC_HOST
=${1#--host=}
64 SUBSONIC_PORT
=${1#--port=}
67 SUBSONIC_HTTPS_PORT
=${1#--https-port=}
70 SUBSONIC_CONTEXT_PATH
=${1#--context-path=}
73 SUBSONIC_MAX_MEMORY
=${1#--max-memory=}
76 SUBSONIC_PIDFILE
=${1#--pidfile=}
81 --default-music-folder=?
*)
82 SUBSONIC_DEFAULT_MUSIC_FOLDER
=${1#--default-music-folder=}
84 --default-podcast-folder=?
*)
85 SUBSONIC_DEFAULT_PODCAST_FOLDER
=${1#--default-podcast-folder=}
87 --default-playlist-folder=?
*)
88 SUBSONIC_DEFAULT_PLAYLIST_FOLDER
=${1#--default-playlist-folder=}
97 # Use JAVA_HOME if set, otherwise assume java is in the path.
99 if [ -e "${JAVA_HOME}" ]
101 JAVA
=${JAVA_HOME}/bin
/java
104 # Create Subsonic home directory.
105 mkdir
-p ${SUBSONIC_HOME}
106 LOG
=${SUBSONIC_HOME}/subsonic_sh.log
110 if [ -L $0 ] && ([ -e /bin
/readlink
] ||
[ -e /usr
/bin
/readlink
]); then
111 cd $
(dirname $
(readlink
$0))
114 ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
115 -Dsubsonic.home
=${SUBSONIC_HOME} \
116 -Dsubsonic.
host=${SUBSONIC_HOST} \
117 -Dsubsonic.port
=${SUBSONIC_PORT} \
118 -Dsubsonic.httpsPort
=${SUBSONIC_HTTPS_PORT} \
119 -Dsubsonic.contextPath
=${SUBSONIC_CONTEXT_PATH} \
120 -Dsubsonic.defaultMusicFolder
=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
121 -Dsubsonic.defaultPodcastFolder
=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
122 -Dsubsonic.defaultPlaylistFolder
=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
123 -Djava.awt.headless
=true \
125 -jar subsonic-booter-jar-with-dependencies.jar
> ${LOG} 2>&1 &
127 # Write pid to pidfile if it is defined.
128 if [ $SUBSONIC_PIDFILE ]; then
129 echo $
! > ${SUBSONIC_PIDFILE}
132 if [ $quiet = 0 ]; then
133 echo Started Subsonic
[PID $
!, ${LOG}]