User talk:OtakuMegane

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
 
=== Modified oswatchdog for multiple instances ===
 
=== Modified oswatchdog for multiple instances ===
This is a modified version of BlueWall's oswatchdog. I had trouble getting the original to run and it was not well designed for multiple instances (I run quite a few). This allows you to easily add as many instances to be monitored as you wish.
+
This is a modified version of [[User_talk:BlueWall#oswatchdog|BlueWall's oswatchdog]]. I had trouble getting the original to run and it was not well designed for multiple instances (I run quite a few). This allows you to easily add as many instances to be monitored as you wish.
  
 
'''NOTE: This assumes you have separate script(s) to launch each instance and apply any relevant settings, whereas BlueWall's original executed the commands directly from the watchdog script.
 
'''NOTE: This assumes you have separate script(s) to launch each instance and apply any relevant settings, whereas BlueWall's original executed the commands directly from the watchdog script.

Revision as of 17:35, 4 June 2010

Modified oswatchdog for multiple instances

This is a modified version of BlueWall's oswatchdog. I had trouble getting the original to run and it was not well designed for multiple instances (I run quite a few). This allows you to easily add as many instances to be monitored as you wish.

NOTE: This assumes you have separate script(s) to launch each instance and apply any relevant settings, whereas BlueWall's original executed the commands directly from the watchdog script.

#! /bin/sh
#
# THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
#
# Adjust To Your System:
#
# Sample Cron Entry: Runs Each Minute 24/7/365
# */1 * * * * exec /opt/opensim/scripts/oswatchdog
#
#
#
# Base opensim installation
BASE="/home/opensim"
 
# Log
LOG="$BASE/status-log.log"
 
# Hostname
HOSTNAME="<Domain or IP address>"
 
#if the file exist, opensim wont be restarted
# Sacha Magne
LOCKFILE="/tmp/norun.opensim"
 
if [ -f "$LOCKFILE" ]; then
        echo $LOCKFILE "found. no restart"
        exit
fi
 
status_check()
{
        running_pid=`ps ax|grep $2|grep -v grep|tr -s ' '|sed 's/^ //'|cut -f1 -d' '`
        if [ -z "$running_pid" ]; then
                #...We Make A Log Entry And Start A New One
                # The Log Entry
                TIME="Simulator $2 Down, Restarting: `/bin/date +"%A, %B %d - %r"`"
                echo $TIME >>$LOG
                /bin/su -l opensim -c "/home/opensim/$3"
        else
                if ! curl "http://$HOSTNAME:$1/simstatus/"
                then
                        kill -KILL $running_pid
                fi
        fi
}
 
# Add a new line for each instance you want to monitor.
# All you need to do is replace each of the three settings with the correct
# values for the instance.
#
# listener port: The port the instance listens to. Is set in OpenSim.ini; default is 9000
# screen name: The name of the screen running the instance
# launch script: The filename of the script that launches the instance
#
# Example: status_check "9000" "OpensimOne" "opensim-one.sh"
#
 
status_check "<listener port>" "<screen name>" "<launch script>"
Personal tools
General
About This Wiki