Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 11th, 2010 | Syntax: None | Size: 2.29 KB | Hits: 70 | Expires: Never
Copy text to clipboard
  1. #! /bin/sh
  2. #
  3. # icecast2
  4. #
  5. #                Written by Miquel van Smoorenburg <miquels@cistron.nl>.
  6. #                Modified for Debian
  7. #                by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  8. #
  9. #                Further modified by Keegan Quinn <ice@thebasement.org>
  10. #                for use with Icecast 2
  11. #
  12.  
  13. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  14. DAEMON=/usr/local/bin/icecast2
  15. NAME=icecast2
  16. DESC=icecast2
  17. ICES=/usr/bin/ices2
  18. ICES_CONFIGFILE=/home/scusio/ices2/ices-playlist.xml
  19.  
  20. test -x $DAEMON || exit 0
  21.  
  22. # Defaults
  23. CONFIGFILE="/home/scusio/icecast.xml"
  24. CONFIGDEFAULTFILE="/etc/default/icecast2"
  25. USERID=icecast2
  26. GROUPID=icecast
  27. ENABLE="false"
  28.  
  29. # Reads config file (will override defaults above)
  30. [ -r "$CONFIGDEFAULTFILE" ] && . $CONFIGDEFAULTFILE
  31.  
  32. if [ "$ENABLE" != "true" ]; then
  33.         echo "$NAME daemon disabled - read $CONFIGDEFAULTFILE."
  34.         exit 0
  35. fi
  36.  
  37. set -e
  38.  
  39. case "$1" in
  40.   start)
  41.         echo -n "Starting $DESC: "
  42.         start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
  43.                 --exec $DAEMON -- -b -c $CONFIGFILE
  44.         sleep 3
  45.         start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
  46.         echo "$NAME."
  47.         ;;
  48.   stop)
  49.         echo -n "Stopping $DESC: "
  50.         start-stop-daemon --stop --oknodo --quiet --exec $ICES
  51.  
  52.         start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
  53.         echo "$NAME."
  54.         ;;
  55.   reload|force-reload)
  56.         echo "Reloading $DESC configuration files."
  57.         start-stop-daemon --stop --oknodo --quiet --exec $ICES
  58.         start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
  59.         sleep 3
  60.         start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
  61.         ;;
  62.   restart)
  63.         echo -n "Restarting $DESC: "
  64.         start-stop-daemon --stop --oknodo --quiet --exec $ICES
  65.  
  66.         start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
  67.         sleep 3
  68.         start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
  69.                 --exec $DAEMON -- -b -c $CONFIGFILE
  70.         sleep 3
  71.         start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
  72.         echo "$NAME."
  73.         ;;
  74.   *)
  75.         echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
  76.         exit 1
  77.         ;;
  78. esac
  79.  
  80. exit 0