Nice job! However, there are a few errors and areas for improvement-
1. You download Subsonic 4.8, but try to untar 4.7
2. Your automated startup will only start subsonic if it is the first jail to be started, AND, will not start Subsonic if the jail is restarted for any reason.
3. If you are building and installing LAME from source anyways, there is no reason to download the tarball from denieru's page. (Your blog might outlast his file mirror, for instance)
Additionally, just because denieru downloaded the packages in that order doesn't mean you have to. The dependency information on openjdk7 will get a bunch of those packages automatically. Also, it might be helpful to provide explanation for why you are mounting the drive read only. Subsonic is capable of doing some work to modify Mp3's, and ro in the fstab will make it break. For instance, you can't upload into the Incoming folder or download Podscasts if it is mounted read only.
A few modifications to require less typing (or copy paste):
Code: Select all
mkdir /var/subsonic
mkdir /var/subsonic/transcode
is the does the same as:
And
Code: Select all
cd /var/subsonic/standalone
tar xvzf /tmp/subsonic-4.7-standalone.tar.gz
Can be written as:
Code: Select all
tar xvzf /tmp/subsonic-4.7-standalone.tar.gz -C /var/subsonic/standalone
The -C argument tells tar to move into the standalone directory before extracting the tarball.
Now, I already solved the subsonic autostart problem (yesterday, in fact). You need to add the following line to the jail's /etc/rc.conf
While you're at it, add:
Then, create a file in /usr/local/etc/rc.d/ called subsonic, and place the following code:
Code: Select all
#!/bin/sh
#
# Developed by: Matthew Kempe, 2013
#
# PROVIDE: subsonic
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=subsonic
rcvar=${name}_enable
load_rc_config "${name}"
#
# Configure the following variables for your installation
#
JAVA="/usr/local/openjdk7/bin/java"
SUBSONIC_HOME="/var/subsonic"
SUBSONIC_STAND="/var/subsonic/standalone"
SUBSONIC_HOST="192.168.1.3"
SUBSONIC_PORT="4040"
SUBSONIC_HTTPS_PORT="0"
SUBSONIC_CONTEXT_PATH="/"
SUBSONIC_MAX_MEMORY="150"
SUBSONIC_PIDFILE="/var/run/${name}.pid"
SUBSONIC_DEFAULT_MUSIC_FOLDER="/var/music"
SUBSONIC_DEFAULT_PODCAST_FOLDER="/var/music/Podcast"
SUBSONIC_DEFAULT_PLAYLIST_FOLDER="/var/music/playlists"
SUBSONIC_LOG="${SUBSONIC_HOME}/subsonic_sh.log"
#
# END user config section
#
required_files="${SUBSONIC_STAND}/subsonic.war"
required_dirs="${SUBSONIC_HOME} ${SUBSONIC_HOME}/transcode ${SUBSONIC_STAND}"
pidfile="${SUBSONIC_PIDFILE}"
start_precmd="rm -f ${SUBSONIC_LOG} && cd ${SUBSONIC_STAND}"
start_cmd=subsonic_start
stop_postcmd="rm -f ${SUBSONIC_PIDFILE}"
command="${JAVA}"
command_args="-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 \
-verbose:gc \
-jar ${SUBSONIC_STAND}/subsonic-booter-jar-with-dependencies.jar > ${SUBSONIC_LOG} 2>&1 &"
subsonic_start() {
eval "${command} ${command_args}"
echo $! > ${SUBSONIC_PIDFILE}
SUBSONIC_PID=`cat ${SUBSONIC_PIDFILE}`
echo "Subsonic started, PID: ${SUBSONIC_PID}"
}
run_rc_command "$1"
You need to modify the files/foldernames as needed (the java bin location is particularly important). Once you do this and mark the script executable, you can interact with subsonic like a normal daemon, /usr/local/etc/rc.d/subsonic {start | stop | status}. Additionally, it will autostart any time the jail gets started.
Enjoy!!