/rc0.d/K20distmp3

http://github.com/brinkman83/bashrc · Shell · 63 lines · 42 code · 11 blank · 10 comment · 6 complexity · 5a9dd89b1d6fcfab01250d8a35ad1b18 MD5 · raw file

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: distmp3
  4. # Required-Start: $remote_fs $syslog
  5. # Required-Stop: $remote_fs $syslog
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. ### END INIT INFO
  9. # distmp3host Start/stop distmp3.
  10. # Version: distmp3host 0.1.9-4 04-Mar-2004 joshk@triplehelix.org
  11. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  12. DAEMON=/usr/bin/distmp3host
  13. NAME=distmp3host
  14. DESC="distributed audio encoder"
  15. test -f $DAEMON || exit 0
  16. if [ -f "/etc/default/distmp3" ]; then
  17. . /etc/default/distmp3
  18. if [ "$1" = start ] && [ -n "$runlevel" -o -n "$in_postinst" ] && [ "$STARTME" = 0 ]; then
  19. echo "Not starting $DESC: dpkg-reconfigure distmp3 to change."
  20. exit 0
  21. fi
  22. if [ -n "$NICELEVEL" ]; then
  23. NICE="-N $NICELEVEL"
  24. fi
  25. fi
  26. set -e
  27. case "$1" in
  28. start)
  29. echo -n "Starting $DESC: $NAME"
  30. start-stop-daemon --start --quiet -c distmp3:distmp3 $NICE --exec $DAEMON
  31. echo "."
  32. ;;
  33. stop)
  34. echo -n "Stopping $DESC: $NAME"
  35. start-stop-daemon --oknodo --stop --quiet \
  36. --pidfile /var/run/distmp3/$NAME.pid --signal 15 >/dev/null
  37. echo "."
  38. ;;
  39. restart|force-reload)
  40. echo -n "Restarting $DESC: $NAME"
  41. start-stop-daemon --stop --quiet --oknodo --pidfile \
  42. /var/run/distmp3/$NAME.pid --signal 15 >/dev/null
  43. sleep 1
  44. start-stop-daemon --start --quiet -c distmp3:distmp3 $NICE --exec $DAEMON
  45. echo "."
  46. ;;
  47. *)
  48. echo "Usage: $0 {start|stop|restart|force-reload}" >&2
  49. exit 1
  50. ;;
  51. esac
  52. exit 0