Native systemd unit for subsonic

Tutorials, tips and tricks.

Moderator: moderators

Native systemd unit for subsonic

Postby Jimbob0i0 » Sun Jan 19, 2014 12:26 am

I knocked this together earlier ... it can probably be cleaned up a bit but it's nicer to have on F20 than the sysVinit script:

Config file:
Code: Select all
[root@server ~]# cat /etc/sysconfig/subsonic
SUBSONIC_HOME="-Dsubsonic.home=/var/subsonic"
SUBSONIC_HOST="-Dsubsonic.host=0.0.0.0"
SUBSONIC_PORT="-Dsubsonic.port=4040"
SUBSONIC_HTTPS_PORT="-Dsubsonic.httpsPort=4043"
SUBSONIC_CONTEXT_PATH="-Dsubsonic.contextPath=/"
SUBSONIC_MAX_MEMORY="-Xmx1024m"
SUBSONIC_DEFAULT_MUSIC_FOLDER="-Dsubsonic.defaultMusicFolder=/var/music"
SUBSONIC_DEFAULT_PODCAST_FOLDER="-Dsubsonic.defaultPodcastFolder=/var/music/Podcast"
SUBSONIC_DEFAULT_PLAYLIST_FOLDER="-Dsubsonic.defaultPlaylistFolder=/var/playlists"


Systemd unit file:
Code: Select all
[root@server ~]# cat /etc/systemd/system/subsonic.service
[Unit]
Description=Subsonic music server

[Service]
EnvironmentFile=/etc/sysconfig/subsonic
User=subsonic
Group=subsonic
WorkingDirectory=/usr/share/subsonic
SyslogIdentifier=subsonic
ExecStart=/usr/bin/java ${SUBSONIC_MAX_MEMORY} ${SUBSONIC_HOME} ${SUBSONIC_HOST} ${SUBSONIC_PORT} ${SUBSONIC_HTTPS_PORT} ${SUBSONIC_CONTEXT_PATH} ${SUBSONIC_DEFAULT_MUSIC_FOLDER} ${SUBSONIC_DEFAULT_PODCAST_FOLDER} ${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} -Djava.awt.headless=true -verbose:gc -jar subsonic-booter-jar-with-dependencies.jar

[Install]
WantedBy=multi-user.target


The java output goes direct to journald rather than being written to /var/subsonic/subsonic_sh.log which is quite nice to check status and behaviour...

Seems to work fairly well and thought it might be useful to someone else ;)
Jimbob0i0
 
Posts: 5
Joined: Thu Jan 31, 2013 10:52 pm

Re: Native systemd unit for subsonic

Postby nelgin » Wed Sep 03, 2014 8:00 am

Although I'm now using madsonic, this was a really useful post, thank you. I just switched to CentOS 7 and was wondering about an alternative way to start madsonic, rather than via rc.local like I did with CentOS 6.5. This worked perfectly by just taking the appropriate parts from the config file.

It'd be nice if this got included in the base for others to use.

Thanks for sharing.
Nigel
nelgin
 
Posts: 41
Joined: Tue Mar 22, 2011 2:04 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests