#!/bin/sh
#
# shout		This shell script takes care of starting and stopping
#		shout.
#
# chkconfig: 345 96 24
# description: Icecast is an Internet audio broadcasting system based on
#              MPEG audio technology. Shout is a streamer for icecast.

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that shout.conf exists.
[ -f /etc/icecast/shout.conf ] || exit 0


# See how we were called.
case "$1" in
  start)
        # Start daemons.
	msg_starting shout
	# daemon --user icecast -s /bin/sh 'shout -z -r -t -3'
	# Our daemon function doesn't include su's --shell option
	su icecast -s /bin/sh -c 'shout -z -r -t -3' 2>&1 > /dev/null
	ok
	touch /var/lock/subsys/shout
	;;
  stop)
        # Stop daemons.
	msg_stopping shout
	killproc shout 2> /dev/null
	rm -f /var/lock/subsys/shout
	;;
  restart)
        $0 stop
        $0 start
        ;;
  status)
	status shout
	;;
  *)
	msg_usage "$0 {start|stop|restart|status}"
	exit 1
esac

exit 0
