Getting mpd to auto-play on startup

HI folks

Here are some instructions and an init script I wrote for getting mpd to auto-play when it (and Volumio) start: https://gist.github.com/captsens/9030856

It may well be possible to get mpd to do this directly, but I haven’t managed to find out how.

As always, I’m happy to take any comments, suggestions for improvement etc.

Cheers … JD

If you shoutdown your mpd while playing music it should start playing again.

This can be achieved just by adding mpc play after mpd_start at the end of /etc/init.d/mpd:

case "$1" in
    start)
        mpd_start
        mpc play
        ;;
    stop)
        mpd_stop
        ;;
    status)
        status_of_proc -p $PIDFILE $DAEMON $NAME
        ;;
    restart|force-reload)
        mpd_stop
        mpd_start
        mpc play
        ;;
    force-start)
        mpd_start
        mpc play
        ;;
    force-restart)
        mpd_stop
        mpd_start
        mpc play
        ;;
    force-reload)
        mpd_stop
        mpd_start
        mpc play
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|force-reload}"
        exit 2
        ;;
esac

Thnank you captsens, your script helped me to figure this out.