icecast startup script

#!/bin/bash
#
# Startup script for icecast
#
# chkconfig: 2345 86 25
# description: Icecast Streaming Server
#
# processname: icecast
# config: /etc/icecast.xml
# pidfile: /usr/share/icecast/icecost.pid

. /etc/rc.d/init.d/functions

RETVAL=0
PIDFILE=/usr/share/icecast/icecost.pid
CONF=/etc/icecast.xml
ICECAST=/usr/bin/icecast
OPTS=”-b -c $CONF”

start()
{
echo -n $”Starting icecast”
daemon icecast $OPTS
RETVAL=$?
[ “$RETVAL” = 0 ] && touch /var/lock/subsys/icecast
echo
pidof icecast >$PIDFILE
return $RETVAL
}

stop()
{
echo -n $”Stopping icecast”
killproc icecast -TERM
RETVAL=$?
[ “$RETVAL” = 0 ] && rm -f /var/lock/subsys/icecast
echo
rm -f $PIDFILE
return $RETVAL
}

reload()
{
echo -n $”Reloading icecast”
killproc icecast -HUP
RETVAL=$?
echo
return $RETVAL
}

condrestart()
{
[ -e /var/lock/subsys/icecast ] && restart
return 0
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
# wait for listening sockets to clear
echo “Waiting 5 seconds before restarting…”
sleep 5
start
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status $ICECAST
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|reload|condrestart|status}”
RETVAL=1
esac
exit $RETVAL

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Security Code:

This site uses Akismet to reduce spam. Learn how your comment data is processed.