Sunday, November 27, 2011

Startup Script Red5 working with ubuntu 11.x

You may  wish have red5 started at boot.
This script should help you.
It is assumed that your red5 script is located at /usr/share/red5:

cd /etc/init.d/
touch red5
chmod 755 red5
vi red5

Paste below code
#! /bin/sh
# /etc/init.d/red5
# Check for missing file
test -x $RED5_DIR/ || exit 5

case "$1" in
      echo -n "Starting Red5 Service"
      echo -n " "
      cd $RED5_DIR
      su -s /bin/bash -c "$RED5_DIR/ &" red5
      sleep 2
       echo -n "Shutting down red5"
       echo -n " "
       su -s /bin/bash -c "killall -q -u red5 java" red5
       sleep 2
       ## Stop the service and regardless of whether it was
       ## running or not, start it again.
       $0 stop
       $0 start

then you maybe need

useradd red5

and use like
service red5 start
service red5 stop
service red5 restart

No comments:

Post a Comment