mpd.init 557 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. #PKG mpd
  3. #INIT 80
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${mpd:-NO}" = x"NO" && exit 0
  9. test x"$mpd" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. if [ ! -d /var/run/mpd ];then
  14. mkdir -p /var/run/mpd
  15. chown mpd:audio /var/run/mpd
  16. fi
  17. if [ ! -d /data/mpd ];then
  18. mkdir -p /data/mpd
  19. fi
  20. touch /data/mpd/state
  21. chown -R mpd:audio /data/mpd
  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 $?