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
Bookmarks