From 3b15d8dcd8912825281367ed959d7ad212e6a0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 8 Apr 2017 21:56:30 +0200 Subject: Add user services --- service/mpd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 service/mpd (limited to 'service/mpd') diff --git a/service/mpd b/service/mpd new file mode 100755 index 0000000..4f0f467 --- /dev/null +++ b/service/mpd @@ -0,0 +1,23 @@ +#!/home/cynerd/.local/sbin/user-service.sh +# vim: ft=sh + +description="Music player daemon" +pidfile=".config/mpd/pid" + +MPD_PID=~/.config/mpd/pid +if [ ! -e $MPD_PID ] || ! kill -0 $(cat $MPD_PID); then + mpd ~/.config/mpd/mpd.conf +fi + +status() { + [ -f $pidfile ] || return 1 + kill -0 "$(cat $pidfile)" || return 1 +} + +start() { + mpd ~/.config/mpd/mpd.conf +} + +stop() { + mpd --kill ~/.config/mpd/mpd.conf +} -- cgit v1.2.3