How to get subsonic to work on Synology DS1511+ (10/17/2012)

Tutorials, tips and tricks.

Moderator: moderators

Re: How to get subsonic to work on Synology DS1511+ w/auto s

Postby rivangom » Mon Jul 04, 2011 11:24 pm

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
Subsonic 4.8 (build 3434) Stand-alone version on Synology NAS DS1511+
User avatar
rivangom
 
Posts: 7
Joined: Sat Jun 11, 2011 1:19 pm
Location: Amsterdam

Re: How to get subsonic to work on Synology DS1511+ w/auto s

Postby gamezonline » Wed Jul 06, 2011 4:42 am

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


auto start script works, and is in the OP. far as the auto restart script go's no i have not found a fix for that. to tell the truth haven't had a need to as subsonic have not crashed on me ones
gamezonline
 
Posts: 30
Joined: Thu Feb 24, 2011 8:53 pm

Re: How to get subsonic to work on Synology DS1511+ w/auto s

Postby rivangom » Sat Jul 09, 2011 1:03 pm

Gamezonline,

If possible from your side could you take a look at my files I'm working, where everytime I have to restart the file subsonic.sh script. Command for this: sh /var/subsonic/standalone/subsonic.sh

This is what I have:
Subsonic version 4.5.beta1 (build 2285) – June 19, 2011 installed in: /var/subsonic/standalone/
Java installed: /usr/java/jre1.6.0_26

Subsonic.sh code:
Code: Select all
#!/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



In /usr/syno/etc/rc.d I have the S99Subsonic.sh

Code: Select all
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



I hope this gives you or others an idea of the installation I have and how to solve the issue that I have to restart subsonic.sh everytime. Don't if it a crash, I'm not clear on that yet.

Many thanks and regards,
Robbert van Gom Neumann
Subsonic 4.8 (build 3434) Stand-alone version on Synology NAS DS1511+
User avatar
rivangom
 
Posts: 7
Joined: Sat Jun 11, 2011 1:19 pm
Location: Amsterdam

Postby gamezonline » Sat Jul 09, 2011 1:43 pm

hmm, everything looks ok. just to make sure

did you change permission on both S99Subsonic.sh & subsonic.sh to 777? If you didnt or not sure use this.


Code: Select all
chmod 777 /var/subsonic/standalone/subsonic.sh


Code: Select all
chmod 777 /usr/syno/etc/rc.d/S99Subsonic.sh


reboot your nas, and subsonic should autostart. (you can reboot via telnet just by entering "reboot" command
gamezonline
 
Posts: 30
Joined: Thu Feb 24, 2011 8:53 pm

Postby rivangom » Sat Jul 09, 2011 6:08 pm

Gamezonline,

This worked!! Many thanx. U R the Star of my week.

Regards,
Robbert van Gom Neumann
Subsonic 4.8 (build 3434) Stand-alone version on Synology NAS DS1511+
User avatar
rivangom
 
Posts: 7
Joined: Sat Jun 11, 2011 1:19 pm
Location: Amsterdam

Postby stanthewizzard » Mon Jul 11, 2011 11:01 am

Everything is working very fine (with latest beta 4.5.1)

BUT
I'm unable to use LAME.
I created a subdir transcode (in /var/subsonic/standalone/transcode)
Moved the necessary files
and nothing works

I need some help

Much thanks for this tutorial
:D
stanthewizzard
 
Posts: 21
Joined: Mon Jul 11, 2011 10:58 am

Postby IWarez » Mon Jul 11, 2011 12:42 pm

My lame is located in \var\subsonic\transcode. That should help ;)
IWarez
 
Posts: 13
Joined: Sat Mar 12, 2011 11:10 am

Postby stanthewizzard » Tue Jul 12, 2011 7:36 am

In fact I think i need lame and ffmepg for linux.
Can't find it .....
stanthewizzard
 
Posts: 21
Joined: Mon Jul 11, 2011 10:58 am

Postby IWarez » Wed Jul 13, 2011 6:02 pm

I think you are up for some hardcore console action ;). I compiled both lame and ffmpeg from source. For that you will need to install GCC. I don't think it is possible to just copy the binaries from my system to yours. The compile process puts the compiled files at several locations and I have no idea what is required where.

edit:
Just to try it and prevent you from headaches I created a zip file with the structure I think you need. Download the file from here and extract it to /usr/local. You could test the binaries by executing /usr/local/bin/lame and|or /usr/local/bin/ffmpeg. If that works all you need to do is create the symbolic links to ffmpeg and lame in /var/subsonic/transcode

edit 2:
I played around even more and you are probably able to enter the command:
ipkg install lame

That will install lame for you. ffmpeg is already on your synology box. It's located in /usr/syno/bin

This will still require you to make symbolic links in the /var/subsonic/transcode folder but it won't require compiling!
IWarez
 
Posts: 13
Joined: Sat Mar 12, 2011 11:10 am

Postby stanthewizzard » Fri Jul 22, 2011 9:00 am

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
stanthewizzard
 
Posts: 21
Joined: Mon Jul 11, 2011 10:58 am

Postby gamezonline » Fri Jul 22, 2011 12:17 pm

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


I was the same way when i first got my nas, but as for me I was hell bent on learning Linux. To tell the truth, had to use the recovery disk on my nas a few times when I was new new to Linux, now i'm just there. :p

A little disclaimer, what you about to do is change the bootstrap to enable ipkg, I AM NOT RESPONSIBLE FOR ANY DATA LOST WILL DOING THIS!!!

1. Ran 'cd /volume1/tmp'
3. entered the command 'wget http://ipkg.nslu2-linux.org/feeds/optwa ... _i686.xsh'
4. Ran 'sh syno-i686-bootstrap_1.2-7_i686.xsh'
5. Rebooted the NAS with 'reboot' command
6. Updated the ipkg list of available packages using the command 'ipkg update'

Oh almost for got here how you use symbolic links
http://help.hardhathosting.com/question.php/95
gamezonline
 
Posts: 30
Joined: Thu Feb 24, 2011 8:53 pm

Postby stanthewizzard » Fri Jul 22, 2011 3:08 pm

Aouch
Changing the bootstrap .... maybe with a NAS with no important data ... not on this NAS.
I'll try on my spare one at work !!! :) (test only nas)
stanthewizzard
 
Posts: 21
Joined: Mon Jul 11, 2011 10:58 am

Postby IWarez » Sat Jul 23, 2011 8:52 pm

About the crashes you mention: I have none. Subsonic and a few other services run flawlessly on my ds710.

Regarding the bootstrap: it sounds harder than it is. It's really nothing different than running a batch file on Windows. I have yet to encounter any problems with it.
IWarez
 
Posts: 13
Joined: Sat Mar 12, 2011 11:10 am

Re: How to get subsonic to work on Synology DS1511+ w/auto s

Postby gigon » Wed Dec 14, 2011 12:32 am

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 www.eg-blog.de
Subsonic Package for Synology DiskStations http://eg-blog.de
gigon
 
Posts: 46
Joined: Thu Dec 01, 2011 12:52 am

Re: How to get subsonic to work on Synology DS1511+ w/auto s

Postby gamezonline » Thu Dec 15, 2011 2:55 pm

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



I'll be happy to give it a try for you, but I'm currently out town for the holidays, and don't like to "test" stuff without having physical access to the nas, if you no what I mean.
Last edited by gamezonline on Mon Dec 19, 2011 4:25 pm, edited 1 time in total.
gamezonline
 
Posts: 30
Joined: Thu Feb 24, 2011 8:53 pm

PreviousNext

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests