All pastes #357210 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-15 15:11 UTC
rendered paste body
#! /bin/sh
#
# rdstream
#
#		Written by J Hoff. <jhoff@elitepcrepair.com>
#		(shoutcast version)
#		Modified for Debian & icecast2
#		by drew Roberts <zotz@100jamz.com>
#
#		also adapted from icecast2 as follows
# icecast2
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian 
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
#		Further modified by Keegan Quinn <ice@thebasement.org>
#		for use with Icecast 2
#


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DAEMON=/usr/local/bin/rdstream.sh
NAME=RDSTREAM
DESC="rivendell stream metadata"

source /etc/rdstream.conf

test -x $DAEMON || exit 0

# Defaults
CONFIGFILE="/etc/rdstream.conf"
CONFIGDEFAULTFILE="/etc/default/rdstream"
USERID=root
GROUPID=root
ENABLE="false"

# Reads config file (will override defaults above)
[ -r "$CONFIGDEFAULTFILE" ] && . $CONFIGDEFAULTFILE

if [ "$ENABLE" != "true" ]; then
	echo "$NAME daemon disabled - read $CONFIGDEFAULTFILE."
	exit 0
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet  \
		--background --exec $DAEMON -- $CONFIGFILE
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
	echo "$NAME."
	;;
  reload|force-reload)
	echo "Reloading $DESC configuration files."
	start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
	;;
  restart)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
	sleep 1
	start-stop-daemon --start --quiet  \
		--exec $DAEMON -- -b -c $CONFIGFILE
	echo "$NAME."
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0