Live Streaming

Full Version: Init script for Red5 cPanel/CentOS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is a new init script to start/stop/restart Red5 that will work on most RedHat servers. This includes (and was tested on) cPanel/WHM CentOS:
Quote: #!/bin/sh
# Startup script for Red5 flash streaming server on RedHat/CentOS (cPanel)
# chkconfig: 2345 95 55
# description: Red5 Flash Streaming Server
# processname: red5

PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid

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

[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5

RETVAL=0

case "$1" in
start)
echo -n $"Starting $PROG: "
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG

fi
[ $RETVAL -eq 0 ] && success $"$PROG startup" || failure $"$PROG startup"
echo
;;
stop)
echo -n $"Shutting down $PROG: "
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac

exit $RETVAL

To install the Red5 init script:
Quote:vi /etc/init.d/red5
paste the script above than save and close by pressing ESC than typing :wq

How to use the Red5 init script:
Quote:/etc/init.d/red5 start
* use stop to stop Red5 and restart to restart, you can also check the staus: /etc/init.d/red5 status
To install Red5 on cPanel, read this post: http://bit.ly/InstallRed5