Max Ping wrote:
That looks like the kind of thing - the next step would be to rework this so you can run an external "ping" for want of a better word - maybe you have a third server simply monitoring if the regions are up & if it detects that they are stopped to then send an automatic restart request. Like an oswatchdog server
More complicated than I need right now.
One can always telnet to port 9000 on the server, if there's a responce it's probably up
If there's no responce, it's time to mourn the poor server, then fire up ssh and go investigate
and reboot the durn thing
Happy Days!
I did manage to get around to installing OSwatchdog as a crontab in the user account that launches my OpenSim
My first miserable fail was of course my own fault for not {drum roll} rtfm
Yes my friends, even at this late date it still pays to man 5 crontab.
So without further ado, the working code examples.
Here is OSwatchdog -- pretty much as BlueWall published it at
http://opensimulator.org/wiki/User_talk:BlueWall#oswatchdogCode:
#!/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
#
# my crontab.ex for vixie crond
# run every 5 mins
# m h dom mon dow command
#*/5 * * * * /home/pocoloco/Scripts/OSwatchdog
# Where Does Your OpenSim Installation Live?
BASE="/var/opensim"
# Where Do You Run OpenSim.exe From?
RUN="$BASE/current/bin"
# Where Do You Want To Log Events To?
LOG="$BASE/logs"
# Where Is Your Screen Binary?
SCREEN="/usr/bin/screen"
# ... and where or which mono do you want to launch server
MONO="/usr/bin/mono"
#if the file exist, opensim wont be restarted
# Sacha Magne
# add locksimstart and unlocksim to create/delete $LOCKFILE
# PocoLoco Darwin
LOCKFILE="/tmp/norun.opensim"
if [ -f "$LOCKFILE" ]; then
echo $LOCKFILE "found. no restart"
exit
fi
# Check For For Our Screen Process, Named OSR
running=`ps ax|grep OSR|grep -v grep`
# If The Process Is Not There...
if [ -z "$running" ]; then
#...We Make A Log Entry And Start A New One
# The Log Entry
TIME="Simulator Down, Restarting: `/bin/date +"%A, %B %d - %r"`"
echo $TIME >>$LOG/OSGReport.txt
# Start new instance and bind it to screen so we can get to a console session
# "-S" names the session for easy re-attachment ; "-d -m" start new session but don't attach to it
cd $RUN
$SCREEN -S OSR -d -m $MONO OpenSim.exe
fi
# All Done Till Next Time
The lock/unlock scripts
Code:
#!/bin/sh
#locksimstart
# skeleton for a script that writes "norun.opensim" to /tmp
# to stop the automatic restart of opensimulator by OSwatchdog
# need to add cases for cli args , right now it just touches to create
# norun.opensim
touch /tmp/norun.opensim
#!/bin/sh
# unlocksim
# works in tandem with locksimstart
# removes norun.opensim so OSwatchdog will restart on next CRON run
#
rm -f /tmp/norun.opensim
Don't forget to chmod [ugo]+x
or these scripts won't want to run
Install the crontab entry and watch mono appear in the process table
