mpd.init 516 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. #PKG mpd
  3. #INIT 60
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${mpd:-NO}" = x"NO" && exit 0
  9. exec sh $0 start
  10. ;;
  11. start)
  12. # check group membership
  13. id mpd | grep audio >/dev/null 2>&1
  14. if [ $? -ne 0 ];then
  15. echo "mpd user must be in group audio."
  16. exit 1
  17. fi
  18. if [ ! -d /var/run/mpd ];then
  19. mkdir -p /var/run/mpd
  20. chown mpd:mpd /var/run/mpd
  21. fi
  22. mpd
  23. ;;
  24. stop)
  25. mpd --kill
  26. ;;
  27. restart)
  28. sh $0 stop
  29. sh $0 start
  30. ;;
  31. *)
  32. echo "Usage: $0 {start | stop | restart}"
  33. exit 1
  34. ;;
  35. esac
  36. exit $?