I'm running Red5 on Solaris.
Here's my general SysV init script in bash.

* accepts start, stop, restart
* stores and recovers the pid (I don't believe in grepping the process table 
for red5 - what if I'm editing a file with "red5" in the path?)
* runs as a specified user

You'll want to adjust the variables at the top (for your JAVA_HOME, or 
RED5_USER for instance)

Comments, patches and jeers welcome.

cheers,
ben

-- 
Benjamin H Kram
[EMAIL PROTECTED]
617.998.8592
#!/bin/bash

# start/stop script for Red5
# Ben H Kram <[EMAIL PROTECTED]>

JAVA_HOME=/usr/local/jre
RED5_HOME=/home/red5
RED5_USER=red5
RED5_PIDFILE=/var/run/red5.pid
RED5_LOG=/var/log/red5.log

export JAVA_HOME RED5_HOME RED5_USER RED5_LOG

start() {
        echo "Starting Red5"
        if [ -f $RED5_PIDFILE ] ; then
                RED5_PID=`cat $RED5_PIDFILE`
                echo "Looks like Red5 is already running on pid ${RED5_PID}. If 
this is in error, please delete ${RED5_PIDFILE}"
                exit 1
        fi
        touch $RED5_LOG
        chown $RED5_USER $RED5_LOG
        RED5_PID=`/usr/bin/su $RED5_USER -c '(cd ${RED5_HOME};exec 
${RED5_HOME}/red5.sh >> ${RED5_LOG} & echo $!)'`
        echo $RED5_PID > $RED5_PIDFILE
}

stop()  {
        if [ -f $RED5_PIDFILE ] ; then
                echo "Stopping Red5"
                echo "Stopping Red5" >> $RED5_LOG
                kill `cat ${RED5_PIDFILE}`
                /bin/rm -f $RED5_PIDFILE
        fi
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                sleep 3
                start
                ;;
        *)
                echo "Usage /etc/init.d/red5  { start | restart | stop }"
                ;;
esac

exit 0
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to