Native systemd support

Got an idea? Missing something? Post your feature request here.

Native systemd support

Unread postby StalkerNOVA » 16 Jun 2016, 05:23

/usr/lib/systemd/system/madsonic.service
Code: Select all
[Unit]
Description=Madsonic media streaming solution

[Service]
User=madsonic
Group=madsonic
EnvironmentFile=/etc/conf.d/madsonic
ExecStart=/usr/bin/madsonic \
   --init-memory=192 \
   --pidfile=/run/madsonic/madsonic.pid \
   --update=false \
   --home=${MADSONIC_HOME} \
   --host=${MADSONIC_HOST} \
   --port=${MADSONIC_PORT} \
   --https-port=${MADSONIC_HTTPS_PORT} \
   --context-path=${MADSONIC_CONTEXT_PATH} \
   --max-memory=${MADSONIC_MAX_MEMORY} \
   --default-music-folder=${MADSONIC_DEFAULT_MUSIC_FOLDER} \
   --default-upload-folder=${MADSONIC_DEFAULT_UPLOAD_FOLDER} \
   --default-podcast-folder=${MADSONIC_DEFAULT_PODCAST_FOLDER} \
   --default-playlist-import-folder=${MADSONIC_DEFAULT_PLAYLIST_IMPORT_FOLDER} \
   --default-playlist-export-folder=${MADSONIC_DEFAULT_PLAYLIST_EXPORT_FOLDER} \
   --default-playlist-backup-folder=${MADSONIC_DEFAULT_PLAYLIST_BACKUP_FOLDER} \
   --default-transcode-folder=${MADSONIC_DEFAULT_TRANSCODE_FOLDER} \
   --timezone=${MADSONIC_DEFAULT_TIMEZONE} \
   --gzip=${MADSONIC_GZIP}
PIDFile=/run/madsonic/madsonic.pid

[Install]
WantedBy=multi-user.target


/usr/lib/tmpfiles.d/madsonic.conf
Code: Select all
d /run/madsonic 0755 madsonic madsonic


This version will use for settings /etc/conf.d/madsonic
StalkerNOVA
Contributor
Contributor
 
Posts: 19
Joined: 15 Jun 2016, 08:24
Has thanked: 0 time
Been thanked: 5 times

Re: Native systemd support

Unread postby StalkerNOVA » 16 Jun 2016, 05:25

True systemd-way

Change /usr/lib/systemd/system/madsonic.service
Code: Select all
[Unit]
Description=Madsonic media streaming solution

[Service]
User=madsonic
Group=madsonic
ExecStart=/usr/bin/madsonic \
   --init-memory=192 \
   --pidfile=/run/madsonic/madsonic.pid \
   --update=false \
   --home=${MADSONIC_HOME} \
   --host=${MADSONIC_HOST} \
   --port=${MADSONIC_PORT} \
   --https-port=${MADSONIC_HTTPS_PORT} \
   --context-path=${MADSONIC_CONTEXT_PATH} \
   --max-memory=${MADSONIC_MAX_MEMORY} \
   --default-music-folder=${MADSONIC_DEFAULT_MUSIC_FOLDER} \
   --default-upload-folder=${MADSONIC_DEFAULT_UPLOAD_FOLDER} \
   --default-podcast-folder=${MADSONIC_DEFAULT_PODCAST_FOLDER} \
   --default-playlist-import-folder=${MADSONIC_DEFAULT_PLAYLIST_IMPORT_FOLDER} \
   --default-playlist-export-folder=${MADSONIC_DEFAULT_PLAYLIST_EXPORT_FOLDER} \
   --default-playlist-backup-folder=${MADSONIC_DEFAULT_PLAYLIST_BACKUP_FOLDER} \
   --default-transcode-folder=${MADSONIC_DEFAULT_TRANSCODE_FOLDER} \
   --timezone=${MADSONIC_DEFAULT_TIMEZONE} \
   --gzip=${MADSONIC_GZIP}
PIDFile=/run/madsonic/madsonic.pid

[Install]
WantedBy=multi-user.target


Add /etc/systemd/system/madsonic.service/00default.conf
Code: Select all
[Service]

# The directory where Madsonic will create files.
# Make sure it is writable.
Environment="MADSONIC_HOME=/var/lib/madsonic"

# The host name or IP address on which to bind Madsonic.
# Only relevant if you have multiple network interfaces and want
# to make Madsonic available on only one of them.
Environment="MADSONIC_HOST=0.0.0.0"

# The port on which Madsonic will listen for
# incoming HTTP traffic.
Environment="MADSONIC_PORT=4040"

# The port on which Madsonic will listen for
# incoming HTTPS traffic.
Environment="MADSONIC_HTTPS_PORT=0"

# The context path, i.e., the last part of the Madsonic" URL.
# Typically '/' or '/madsonic'.
Environment="MADSONIC_CONTEXT_PATH=/"

# The memory limit (max Java heap size) in megabytes.
Environment="MADSONIC_MAX_MEMORY=512"

# Configure Madsonic to use this folder for music.
# This option only has effect the first time Madsonic is started.
Environment="MADSONIC_DEFAULT_MUSIC_FOLDER=/var/media/artists"

# Configure Madsonic to use this folder for music.
Environment="MADSONIC_DEFAULT_UPLOAD_FOLDER=/var/media/incoming"

# Configure Madsonic to use this folder for Podcasts.
Environment="MADSONIC_DEFAULT_PODCAST_FOLDER=/var/media/podcast"

# Configure Madsonic to use this folder for playlist import.
Environment="MADSONIC_DEFAULT_PLAYLIST_IMPORT_FOLDER=/var/media/playlists/import"

# Configure Madsonic to use this folder for playlist export.
Environment="MADSONIC_DEFAULT_PLAYLIST_EXPORT_FOLDER=/var/media/playlists/export"

# Configure Madsonic to use this folder for playlist backup.
Environment="MADSONIC_DEFAULT_PLAYLIST_BACKUP_FOLDER=/var/media/playlists/backup"

# Configure Madsonic to use this folder for transcoder.
Environment="MADSONIC_DEFAULT_TRANSCODE_FOLDER="

# Configure Madsonic to use other timezone for time correction
# Example 'Europe/Vienna', 'US/Central', 'America/New_York'"
Environment="MADSONIC_DEFAULT_TIMEZONE="

# Configure Madsonic to use Gzip compression.
Environment="MADSONIC_GZIP=true"
StalkerNOVA
Contributor
Contributor
 
Posts: 19
Joined: 15 Jun 2016, 08:24
Has thanked: 0 time
Been thanked: 5 times

Re: Native systemd support

Unread postby StalkerNOVA » 16 Jun 2016, 05:28

And also here is a repository for Gentoo - https://github.com/Kami-no/overlay
StalkerNOVA
Contributor
Contributor
 
Posts: 19
Joined: 15 Jun 2016, 08:24
Has thanked: 0 time
Been thanked: 5 times


Return to Feature Requests 6.x

Who is online

Users browsing this forum: No registered users and 1 guest