Hello, I was wondering about the feasibility of including a startup script for icecast for redhat/fedora installs? I've had to do an rpm install on an fc4 box, and a source install, rpms couldn't be found for an rh9 machine, yah i know that's old. And in both cases i had to drop in a custom-made startup script, see below. I was wondering esepcially in the case of the rpm, and to a lesser extent the source, if this could be included? I've had to change the below paths for both source and rpm installs since they put items, (Config file and binaries), in different places. Thanks. Dave. #!/bin/bash # # Startup script for icecast # # chkconfig: 2345 86 25 # description: Icecast Streaming Server # # processname: icecast2 # config: /usr/local/icecast/conf/icecast.xml # pidfile: /usr/local/icecast/logs/icecast2.pid # source function library . /etc/rc.d/init.d/functions RETVAL=0 prog="icecast2" # Some functions to make the below more readable ICECAST2=/usr/bin/icecast PID_FILE=/usr/local/icecast/logs/icecast2.pid CONFIG_FILE=/usr/local/icecast/conf/icecast.xml start() { echo -n $"Starting $prog:" # initlog -c "$ICECAST2 $OPTIONS" && success || failure initlog -c "$ICECAST2 -b -c $CONFIG_FILE" && success || failure RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/icecast2 echo } stop() { echo -n $"Stopping $prog:" killproc $ICECAST2 -TERM RETVAL=$? [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/icecast2 echo } restart() { echo -n $"Reloading $prog:" killproc $ICECAST2 -HUP RETVAL=$? echo } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status $ICECAST2 RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|status}" RETVAL=1 esac exit $RETVAL
Hi Dave, I've also written my own startup script, but have since switched to using daemontools with great success. http://www.google.com/search?q=daemontools (second match) http://cr.yp.to/daemontools.html Daemontools is easy to install (you should be able to find an rpm for it). It will allow you to bring up/down icecast, send HUP, and also to automatically restart it in case it would crash. Check it out. Regards, KJ Dave wrote:> Hello, > I was wondering about the feasibility of including a startup script > for icecast for redhat/fedora installs? I've had to do an rpm install > on an fc4 box, and a source install, rpms couldn't be found for an rh9 > machine, yah i know that's old. And in both cases i had to drop in a > custom-made startup script, see below. I was wondering esepcially in > the case of the rpm, and to a lesser extent the source, if this could > be included? I've had to change the below paths for both source and > rpm installs since they put items, (Config file and binaries), in > different places. > Thanks. > Dave. > > #!/bin/bash > # > # Startup script for icecast > # > # chkconfig: 2345 86 25 > # description: Icecast Streaming Server > # > # processname: icecast2 > # config: /usr/local/icecast/conf/icecast.xml > # pidfile: /usr/local/icecast/logs/icecast2.pid > > # source function library > . /etc/rc.d/init.d/functions > > RETVAL=0 > prog="icecast2" > > # Some functions to make the below more readable > ICECAST2=/usr/bin/icecast > PID_FILE=/usr/local/icecast/logs/icecast2.pid > CONFIG_FILE=/usr/local/icecast/conf/icecast.xml > > start() > { > echo -n $"Starting $prog:" > # initlog -c "$ICECAST2 $OPTIONS" && success || failure > initlog -c "$ICECAST2 -b -c $CONFIG_FILE" && success || failure > RETVAL=$? > [ "$RETVAL" = 0 ] && touch /var/lock/subsys/icecast2 > echo > } > > stop() > { > echo -n $"Stopping $prog:" > killproc $ICECAST2 -TERM > RETVAL=$? > [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/icecast2 > echo > } > > restart() > { > echo -n $"Reloading $prog:" > killproc $ICECAST2 -HUP > RETVAL=$? > echo > } > > case "$1" in > start) > start > ;; > stop) > stop > ;; > restart) > stop > start > ;; > status) > status $ICECAST2 > RETVAL=$? > ;; > *) > echo $"Usage: $0 {start|stop|restart|status}" > RETVAL=1 > esac > exit $RETVAL > > _______________________________________________ > Icecast mailing list > Icecast@xiph.org > http://lists.xiph.org/mailman/listinfo/icecast >
Dave, If you want to use it, this is the init script I used on Fedora Core 4. #!/bin/bash # # Init file for Icecast server daemon # # chkconfig: 345 55 25 # description: Icecast streaming mp3 server daemon # # processname: icecast # config: /etc/icecast.xml # pidfile: /var/run/icecast.pid # source function library . /etc/rc.d/init.d/functions # pull in sysconfig settings [ -f /etc/sysconfig/icecast ] && . /etc/sysconfig/icecast RETVAL=0 prog="icecast" # Some functions to make the below more readable PREFIX=/usr PATH=$PATH:$PREFIX/bin PIDFILE=/var/run/icecast.pid CONF_FILE=/etc/icecast.xml [ -f $PREFIX/bin/icecast ] || ( echo Failed to locate icecast binary: $PREFIX/bin/icecast && exit ) [ -f $CONF_FILE ] || ( echo Failed to locate icecast configuration file: $CONF_FILE && exit ) OPTIONS="-b -c $CONF_FILE" start() { echo -n $"Starting $prog:" ulimit -c unlimited # dump core for debugging purposes ulimit -n 32768 daemon icecast icecast $OPTIONS RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/icecast echo pidof icecast > $PIDFILE return $RETVAL } stop() { echo -n $"Stopping $prog:" killproc icecast -TERM RETVAL=$? [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/icecast echo rm -f $PIDFILE return $RETVAL } reload() { echo -n $"Reloading $prog:" 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 Regards, KJ Dave schreef:> Hello, > I was wondering about the feasibility of including a startup script > for icecast for redhat/fedora installs? I've had to do an rpm install > on an fc4 box, and a source install, rpms couldn't be found for an rh9 > machine, yah i know that's old. And in both cases i had to drop in a > custom-made startup script, see below. I was wondering esepcially in > the case of the rpm, and to a lesser extent the source, if this could > be included? I've had to change the below paths for both source and > rpm installs since they put items, (Config file and binaries), in > different places. > Thanks. > Dave. > > #!/bin/bash > # > # Startup script for icecast > # > # chkconfig: 2345 86 25 > # description: Icecast Streaming Server > # > # processname: icecast2 > # config: /usr/local/icecast/conf/icecast.xml > # pidfile: /usr/local/icecast/logs/icecast2.pid > > # source function library > . /etc/rc.d/init.d/functions > > RETVAL=0 > prog="icecast2" > > # Some functions to make the below more readable > ICECAST2=/usr/bin/icecast > PID_FILE=/usr/local/icecast/logs/icecast2.pid > CONFIG_FILE=/usr/local/icecast/conf/icecast.xml > > start() > { > echo -n $"Starting $prog:" > # initlog -c "$ICECAST2 $OPTIONS" && success || failure > initlog -c "$ICECAST2 -b -c $CONFIG_FILE" && success || failure > RETVAL=$? > [ "$RETVAL" = 0 ] && touch /var/lock/subsys/icecast2 > echo > } > > stop() > { > echo -n $"Stopping $prog:" > killproc $ICECAST2 -TERM > RETVAL=$? > [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/icecast2 > echo > } > > restart() > { > echo -n $"Reloading $prog:" > killproc $ICECAST2 -HUP > RETVAL=$? > echo > } > > case "$1" in > start) > start > ;; > stop) > stop > ;; > restart) > stop > start > ;; > status) > status $ICECAST2 > RETVAL=$? > ;; > *) > echo $"Usage: $0 {start|stop|restart|status}" > RETVAL=1 > esac > exit $RETVAL > > _______________________________________________ > Icecast mailing list > Icecast@xiph.org > http://lists.xiph.org/mailman/listinfo/icecast > >