Native systemd unit for subsonic
Posted: 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:
Systemd unit file:
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
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