Startup script for Red5 on Ubuntu 9.04

Posted by user49249 on Server Fault See other posts from Server Fault or by user49249
Published on 2010-08-01T19:16:40Z Indexed on 2010/12/29 18:55 UTC
Read the original article Hit count: 278

Filed under:
|

I am creating startup script for Red5 on Ubuntu. Red5 is installed in /opt/red5

Following is a working script on a CentOS Box on which Red5 is running [code]

==========Start init script ==========

 #!/bin/sh


    PROG=red5
    RED5_HOME=/opt/red5/dist
    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

[/code] What do I need to replace for Ubuntu in the above script.

My Red5 is in /opt/red5/ and to start it manually I always do

/opt/red5/dist/red5.sh from Ubuntu As I did not find rc.d/functions on Ubuntu on my laptop also /etc/init.d/functions I did not existed. I would like to be able to use them with service as Red hat distributions do. I checked /lib/lsb/init-functions.

© Server Fault or respective owner

Related posts about streaming

Related posts about servers