Koozali.org: home of the SME Server

Service Error: Red5 RTMP Media Server

Offline newburns

  • *
  • 345
  • +0/-0
  • A good plumber, noob developer
    • Mt. Rose MEdia
Service Error: Red5 RTMP Media Server
« on: June 10, 2012, 07:36:06 AM »
This is how I installed Red5 on my SME 8 x64 build:
First up is Java >>> http://forums.contribs.org/index.php/topic,48744.new.html#new
Next up is ant >>>
Go here for latest version http://opensource.become.com/apache/ant/binaries/
or
Code: [Select]
wget http://opensource.become.com/apache/ant/binaries/apache-ant-1.8.4-bin.tar.gz
tar -xvzf apache-ant-1.8.4-bin.tar.gz
mv apache-ant-1.8.4 /usr/local/ant
Now to set some variables (Please make sure these files are where you point them)
Code: [Select]
export JAVA_HOME=/usr/java/latest
export ANT_HOME=/usr/local/ant
echo 'export ANT_HOME=/usr/local/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/java/latest' >> /etc/bashrc
ln -s /usr/local/ant/bin/ant /usr/bin/ant
:::Now it is time to install Red5 Media Server:::
Code: [Select]
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv -r red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist
make
cp -r dist/conf .
./red5.sh

Once you see
Code: [Select]
[INFO] [Launcher:/installer] org.red5.server.service.Installer - Installer service createdhit CTRL-C to exit. It will sort of stop there. Then
Code: [Select]
nano /etc/init.d/red5and paste in
Code: [Select]
#! /bin/sh
#
# chkconfig: 345 85 15
# description: Controls Red5 Flash media server as a Linux service.
#
# red5         red5 initscript (adapted by Jez for RedHat/CentOS)
#
# Author:      Simon Eisenmann <simon@struktur.de>
#              Jeremy Morton <jez9999@gmail.com>
#

RETVAL=0
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Red5 flash streaming server"
NAME=red5
RED5_HOME=/usr/lib/red5
DAEMON=$RED5_HOME/$NAME.sh

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

# Read config file if it is present.
if [ -r /etc/default/$NAME ]
then
    . /etc/default/$NAME
fi

#
#    Function that starts the daemon/service.
#
d_start() {
    if [ -f /var/run/red5.pid ]; then
        RED5PID=`cat /var/run/red5.pid`
        RED5RUNNING=`ps -fp $RED5PID | grep $RED5PID`
        if [ "$RED5RUNNING" != "" ]; then
            echo "Can't start red5; already active (PID $RED5PID)..."
            return 0
        else
            echo "Can't start red5; not active, but PID file (/var/run/red5.pid) has not been deleted."
            return 1
        fi
    fi

    mv /var/log/red5.log /var/log/red5_previous.log
    cd $RED5_HOME
    export LD_LIBRARY_PATH=$RED5_HOME/webapps/
    su -c "$RED5_HOME/red5.sh > /var/log/red5.log 2>&1 & /bin/echo \$! > /var/run/red5.pid" root
    RETVAL=$?
    echo
    return $RETVAL
}

#
#    Function that stops the daemon/service.
#
d_stop() {
    cd $RED5_HOME
    $RED5_HOME/red5-shutdown.sh
    RETVAL=$?
    rm /var/run/red5.pid
    echo
    return $RETVAL
}

case "$1" in
  start)
    echo -n "Starting $DESC: $NAME"
    echo
    d_start
    echo "."
    ;;
  stop)
    echo -n "Stopping $DESC: $NAME"
    echo
    d_stop
    echo "."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: $NAME"
    echo
    d_stop
    sleep 1
    d_start
    echo "."
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0
now CTRL-X and save.
Code: [Select]
chmod 755 /etc/init.d/red5
chmod +x /etc/init.d/red5
ln -s /etc/init.d/red5 /etc/rc.d/rc0.d/K02red5
ln -s /etc/init.d/red5 /etc/rc.d/rc1.d/K02red5
ln -s /etc/init.d/red5 /etc/rc.d/rc2.d/K02red5
ln -s /etc/init.d/red5 /etc/rc.d/rc6.d/K02red5
ln -s /etc/init.d/red5 /etc/rc.d/rc7.d/S98red5
And now to make it bootable
Code: [Select]
chkconfig red5 resetIt should be installed.
Code: [Select]
chkconfig --list | grep red5
Code: [Select]
config set red5 service access public status enabled TCPPort 5080
signal-event remoteaccess-update 
Code: [Select]
service red5 startHowever I get this
Code: [Select]
Starting Red5 flash streaming server: red5
mv: cannot stat `/var/log/red5.log': No such file or directory
bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `/usr/local/red5/red5.sh > /var/log/red5.log 2>&1 & /bin/echo $! > '

.
Please Help
SME 8.0
Quad 6600
8gb DDR2 800
8 TB RAID 5
Dual Gigabit NIC
I Still Don't KNOW WHAT I AM DOING. Please, don't assume I know anything about Linux or Centos, I just know hardware

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: Service Error: Red5 RTMP Media Server
« Reply #1 on: June 10, 2012, 04:07:33 PM »
Code: [Select]
...
mv /var/log/red5.log /var/log/red5_previous.log
...

Try creating /var/log/red5.log first using:
touch /var/log/red5.log

Offline newburns

  • *
  • 345
  • +0/-0
  • A good plumber, noob developer
    • Mt. Rose MEdia
Re: Service Error: Red5 RTMP Media Server
« Reply #2 on: June 10, 2012, 05:37:53 PM »
Now I get this message (please note the spaces with the period at the end, is that normal?)
Code: [Select]
Starting Red5 flash streaming server: red5
bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `/usr/local/red5/red5.sh > /var/log/red5.log 2>&1 & /bin/echo $! > '

.

Maybe someone can help me rewrite the service file? I don't understand it, and just copied and pasted from Red5 wiki
SME 8.0
Quad 6600
8gb DDR2 800
8 TB RAID 5
Dual Gigabit NIC
I Still Don't KNOW WHAT I AM DOING. Please, don't assume I know anything about Linux or Centos, I just know hardware

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: Service Error: Red5 RTMP Media Server
« Reply #3 on: June 10, 2012, 06:57:33 PM »
Confirm that red5 runs and works if you just run it manually using /usr/lib/red5/red5.sh (output logs will be sent to the console).

I found an alternative startup script here.

Offline newburns

  • *
  • 345
  • +0/-0
  • A good plumber, noob developer
    • Mt. Rose MEdia
Re: Service Error: Red5 RTMP Media Server
« Reply #4 on: June 11, 2012, 04:11:16 AM »
Red5 does run. I can view the webpage, however, I cannot view the installer page for apps. I will tackle that once I get this startup script to work properly. I used the alternative script you posted, and saved my original as 'red5_backup'
However, I get this message.
Code: [Select]
service red5 start
/etc/rc7.d/S98red5: line 50: stop: command not found
/etc/rc7.d/S98red5: line 50: restart: command not found
/etc/rc7.d/S98red5: line 50: status}.: command not found

I guess it is something with the stop, restart, and status commands. I think it has something to do with format, but I don't know the format.
SME 8.0
Quad 6600
8gb DDR2 800
8 TB RAID 5
Dual Gigabit NIC
I Still Don't KNOW WHAT I AM DOING. Please, don't assume I know anything about Linux or Centos, I just know hardware