+ Reply to Thread (include dating software, release, and patch number!)
Results 1 to 5 of 5

Thread: Check if RED5 is running and restart if not

  1. #1
    Administrator Smoge's Avatar
    Join Date
    Mar 2005
    Posts
    6,642
    Blog Entries
    5

    Default Check if RED5 is running and restart if not

    Some people were asking on UNITY how to check if RED5 is running, and if not, try to restart it.

    While checking port 5080 / 1935 port results is also helpful, to see if RED5 is running, but unresponsive... which the script below does not do... the script below does check to see if RED5 is running (locked or not, we don't know), and if not running, it tries to re-start it.

    Code:
    #!/bin/bash
    
    #Path to Ray Server's folder
    RAY_SERVER_PATH=/your/path/to/RMS
    
    PID=`ps ax | grep java | grep red5 | gawk 'BEGIN {FS=" "} { print $1 }'`
    if [[ $PID > 0 ]] ; then
        echo "Red5 Appears To Be Running..."
        exit 0
    fi
    
    #Start RED5
    $RAY_SERVER_PATH/red5.sh >/dev/null 2>&1 &
    echo "Red5 Restart Attempted..."
    exit 1
    In general however, it is what people were asking for.

    Warm regards,
    Smoge
    Last edited by Smoge; 05-30-2010 at 01:41 AM.
    ModMySite Administrator

    Problems? Questions? Need modifications or other help with your site?

    Open A Ticket , Send Us An Email Or Give Us A Telephone Call +1 518-632-4152.

  2. #2
    Administrator Smoge's Avatar
    Join Date
    Mar 2005
    Posts
    6,642
    Blog Entries
    5

    Default

    Updated script.... restarts correctly, and also supports more than one RMS running on a single server (under different user IDs).

    Code:
    #!/bin/bash
    # Discussion : http://www.modmysite.com/ray-community-widget-suite/10494-check-if-red5-running-restart-if-not.html
    # Support    : support@modmysite.com
    
    # Configure values below
    
    # Username of script owned
    USERNAME=SET UNIX USERNAME HERE
    # Path to RMS install folder (contains red5.sh)
    RAY_SERVER_PATH=/home/$USERNAME/RMS_7.0
    
    # Do not change below this line.
    
    PID=`ps ax | grep $USERNAME | grep java | grep red5 | gawk 'BEGIN {FS=" "} { print $1 }'`
    if [[ $PID > 0 ]] ; then
        # If up we don't do or return anything comment out below.
        echo "Red5 Is Up For Username $USERNAME On PID $PID ..."
        exit 0
    fi
    
    #Start RED5
    cd $RAY_SERVER_PATH
    $RAY_SERVER_PATH/red5.sh >/dev/null 2>&1 &
    echo "Red5 Appeared To Be Down For $USERNAME ... Restart Attempted..."
    exit 1
    Last edited by Smoge; 06-06-2010 at 11:51 PM. Reason: tweaked code a bit
    ModMySite Administrator

    Problems? Questions? Need modifications or other help with your site?

    Open A Ticket , Send Us An Email Or Give Us A Telephone Call +1 518-632-4152.

  3. #3
    patrick81's Avatar
    Join Date
    Jan 2012
    Posts
    3

    Default

    Quote Originally Posted by Smoge View Post
    Some people were asking on UNITY how to check if RED5 is running, and if not, try to restart it.

    While checking port 5080 / 1935 port results is also helpful, to see if RED5 is running, but unresponsive... which the script below does not do... the script below does check to see if RED5 is running (locked or not, we don't know), and if not running, it tries to re-start it.

    Code:
    #!/bin/bash
    
    #Path to Ray Server's folder
    RAY_SERVER_PATH=/your/path/to/RMS
    
    PID=`ps ax | grep java | grep red5 | gawk 'BEGIN {FS=" "} { print $1 }'`
    if [[ $PID > 0 ]] ; then
        echo "Red5 Appears To Be Running..."
        exit 0
    fi
    
    #Start RED5
    $RAY_SERVER_PATH/red5.sh >/dev/null 2>&1 &
    echo "Red5 Restart Attempted..."
    exit 1
    In general however, it is what people were asking for.

    Warm regards,
    Smoge


    OH MY GOD! This is excatly what I'm looking for! I'm actually using the other chat script which is FlashComs but still using the same Ray Server (RMS). I notice that RMS gets down once a week randomly. I have to restart it to get it to work again. It gets annoying when I forget and they start complaining. This sounds like a perfect solution!!

    Where do I put this script? Do I need to put this in .htacess? My Ray Server path now is /opt/ray_server/RMS_7.0/ Please let me know. I really appreciate it.

    Nice Forum by the way!

    Patrick
    Last edited by patrick81; 2 Weeks Ago at 12:57 PM.

  4. #4
    Administrator Smoge's Avatar
    Join Date
    Mar 2005
    Posts
    6,642
    Blog Entries
    5

    Default

    You run it as a cron job - so it checks every X minutes.

    As for your RED5 crashing, usually this is because it needs more RAM allocated to it.
    ModMySite Administrator

    Problems? Questions? Need modifications or other help with your site?

    Open A Ticket , Send Us An Email Or Give Us A Telephone Call +1 518-632-4152.

  5. #5
    patrick81's Avatar
    Join Date
    Jan 2012
    Posts
    3

    Default

    Quote Originally Posted by Smoge View Post
    You run it as a cron job - so it checks every X minutes.

    As for your RED5 crashing, usually this is because it needs more RAM allocated to it.

    Yeah, I wish that was the reason but as i see on my webmin, i have 11.89 GB of ram and it's using 578.99 MB right now. I usually don't have many chatters in the room. I say the biggest group i've ever got was 15 chatters. I don't think RED5 crashes because of it. I don't know really.

    I can try this method. This sounds pretty good idea actually. I'm sorry, i don't quite understand it. I normally create a new scheduled cron job on Webmin. So I do it here....





    If this is the right place, what should i put in for Execute cron job and command? What about the time? select "ALL" for each one? Please let me know.

    I really appreciate your help!
    Last edited by patrick81; 1 Week Ago at 10:34 PM.

+ Reply to Thread (include dating software, release, and patch number!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. ray connection to rms or red5
    By SPARXX73 in forum Ray Community Widget Suite
    Replies: 3
    Last Post: 08-15-2008, 08:02 AM
  2. red5 Server 0.7.0 available....
    By bigal0228 in forum General Issues, Comments, Questions
    Replies: 0
    Last Post: 03-03-2008, 07:39 AM
  3. red5 Speedup in the next release....
    By bigal0228 in forum General Issues, Comments, Questions
    Replies: 0
    Last Post: 01-07-2008, 05:07 PM
  4. red5 server version 6.3 released this month.
    By bigal0228 in forum Open Talk
    Replies: 2
    Last Post: 10-02-2007, 12:32 PM
  5. Red5 start
    By samsam in forum General Issues, Comments, Questions
    Replies: 1
    Last Post: 09-18-2006, 11:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts