1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-23 01:20:27 +00:00

update init script and systemd service file

init script: depend on $remote_fs instead of $local_fs. Reason: /usr can
be mounted a remote filesystem. Also depend on mpd (instead of $mpd,
which doesn't seem to exist.. at least on my system)

Also provide a default config (which should be installed as
/etc/default/ympd)

This commit makes the systemd unit file as well as the init script load
values from this configuration file so the user can change ympd settings
easily when running it as a service.
This commit is contained in:
Jason Pleau 2015-05-01 17:11:15 -04:00
parent 3ef53f3cc2
commit 5abfdfda7b
3 changed files with 16 additions and 6 deletions

View File

@ -1,8 +1,8 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: ympd
# Required-Start: $local_fs $mpd
# Required-Stop: $local_fs $mpd
# Required-Start: $remote_fs mpd
# Required-Stop: $remote_fs mpd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Daemonized version of ympd.
@ -20,8 +20,11 @@ PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
LOG_OUT=/var/log/$NAME.out
LOG_ERR=/var/log/$NAME.err
YMPD_USER=mpd
DAEMON_OPT="--user $YMPD_USER --webport 8080"
YMPD_USER=nobody
MPD_HOST=localhost
MPD_PORT=6600
WEB_PORT=8080
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@ -32,6 +35,8 @@ DAEMON_OPT="--user $YMPD_USER --webport 8080"
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
DAEMON_OPT="--user $YMPD_USER --webport $MPD_WEBHOST --host $MPD_HOST --port $MPD_PORT"
do_start()
{
start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \

4
contrib/ympd.default Normal file
View File

@ -0,0 +1,4 @@
MPD_HOST=localhost
MPD_PORT=6600
WEB_PORT=8080
YMPD_USER=nobody

View File

@ -6,8 +6,9 @@ Requires=network.target local-fs.target
Environment=MPD_HOST=localhost
Environment=MPD_PORT=6600
Environment=WEB_PORT=8080
EnvironmentFile=-/etc/conf.d/ympd
ExecStart=/usr/bin/ympd -h $MPD_HOST -p $MPD_PORT -w $WEB_PORT
Environment=YMPD_USER=nobody
EnvironmentFile=/etc/default/ympd
ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $MPD_WEBHOST --host $MPD_HOST --port $MPD_PORT
Type=simple
[Install]