Skip to content

Instantly share code, notes, and snippets.

@fleger
Created March 2, 2012 19:38
Show Gist options
  • Save fleger/1960771 to your computer and use it in GitHub Desktop.
Save fleger/1960771 to your computer and use it in GitHub Desktop.
MPD User Daemon
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/user-rc.d/functions
case "$1" in
start)
stat_busy "Starting Music Player Daemon"
/usr/bin/mpd "${XDG_CONFIG_HOME:-${HOME}/.config}/mpd/mpd.conf" &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
add_user_daemon mpd
stat_done
fi
;;
stop)
stat_busy "Stopping Music Player Daemon"
/usr/bin/mpd --kill "${XDG_CONFIG_HOME:-${HOME}/.config}/mpd/mpd.conf" &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_user_daemon mpd
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
stat_busy "Checking Music Player Daemon status"
ck_user_status mpd
;;
*)
echo "usage: $0 {start|stop|restart|status}"
esac
@fleger
Copy link
Author

fleger commented Mar 6, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment