Test Page

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Starting and stopping the grid server via script: new section)
(Useful Scripts)
Line 1: Line 1:
 
=Useful Scripts=
 
=Useful Scripts=
  
This is a small script to watch for an OpenSim region simulator under screen in Linux. If the process is missing, a new instance will be started.  
+
This is a small script to watch for an OpenSim region simulator under screen in Linux. If the process is missing, a new instance will be started.  
 
+
 
==oswatchdog==
 
==oswatchdog==
<source lang="bash">
 
#!/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
 
#
 
#
 
#
 
# Where Does Your OpenSim Installation Live?
 
BASE="/opt/opensim"
 
# Where Do You Run OpenSim.exe From?
 
RUN="$BASE/production/bin"
 
# Where Do You Want To Log Events To?
 
LOG="$BASE/log"
 
# Where Is Your Screen Binary?
 
SCREEN="/usr/bin/screen"
 
  
 
+
<source lang="bash">
#if the file exist, opensim wont be restarted
+
#!/bin/sh
# Sacha Magne
+
#
LOCKFILE="/tmp/norun.opensim"
+
# THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
 
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
if [ -f "$LOCKFILE" ]; then
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  echo $LOCKFILE "found. no restart"
+
# DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  exit
+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
fi
+
# (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
# Check For For Our Screen Process, Named OSG
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
running=`ps ax|grep OSG|grep -v grep`
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
#
# If The Process Is Not There...
+
#
if [ -z "$running" ]; then
+
#
#...We Make A Log Entry And Start A New One
+
# Adjust To Your System:
# The Log Entry
+
#
TIME="Simulator Down, Restarting: `/usr/bin/date +"%A, %B %d - %r"`"
+
# Sample Cron Entry: Runs Each Minute 24/7/365
 
+
# */1 * * * * exec /opt/opensim/scripts/oswatchdog
echo $TIME >>$LOG/OSGReport.txt
+
#
cd $RUN
+
#
$SCREEN -S OSG -d -m mono OpenSim.exe
+
#
fi
+
# Where Does Your OpenSim Installation Live?
# All Done Till Next Time
+
BASE="/opt/opensim"
 
+
# Where Do You Run OpenSim.exe From?
 
+
RUN="$BASE/production/bin"
=o=
+
# Where Do You Want To Log Events To?
 +
LOG="$BASE/log"
 +
# Where Is Your Screen Binary?
 +
SCREEN="/usr/bin/screen"
 +
 +
 +
#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
 +
 +
 +
# Check For For Our Screen Process, Named OSG
 +
running=`ps ax|grep OSG|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: `/usr/bin/date +"%A, %B %d - %r"`"
 +
 +
echo $TIME >>$LOG/OSGReport.txt
 +
cd $RUN
 +
$SCREEN -S OSG -d -m mono OpenSim.exe
 +
fi
 +
# All Done Till Next Time
 +
</source>
 +
 +
-----------------------------------------------------------------------------------------------------------------
  
 
== Starting and stopping the grid server via script  ==
 
== Starting and stopping the grid server via script  ==
 
+
<source lang="bash">
 
  #!/bin/sh
 
  #!/bin/sh
 
  #
 
  #
Line 111: Line 112:
 
   
 
   
 
   esac
 
   esac
 +
</source>

Revision as of 13:09, 23 November 2008

Useful Scripts

This is a small script to watch for an OpenSim region simulator under screen in Linux. If the process is missing, a new instance will be started.

oswatchdog

#!/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
 #
 #
 #
 # Where Does Your OpenSim Installation Live?
 BASE="/opt/opensim"
 # Where Do You Run OpenSim.exe From?
 RUN="$BASE/production/bin"
 # Where Do You Want To Log Events To?
 LOG="$BASE/log"
 # Where Is Your Screen Binary?
 SCREEN="/usr/bin/screen"
 
 
 #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
 
 
 # Check For For Our Screen Process, Named OSG
 running=`ps ax|grep OSG|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: `/usr/bin/date +"%A, %B %d - %r"`"
 
 	echo $TIME >>$LOG/OSGReport.txt
 	cd $RUN
 	$SCREEN -S OSG -d -m mono OpenSim.exe
 fi
 # All Done Till Next Time

Starting and stopping the grid server via script

#!/bin/sh
 #
 # where does your OpenSim live?
 export OSDIR=/opt/opensim/OSDev/production/bin
 
 case $1 in
 
 	'start')
 
 	cd $OSDIR
 	screen -dmS US mono OpenSim.Grid.UserServer.exe
 	sleep 3
 	screen -dmS GS mono OpenSim.Grid.GridServer.exe
 	sleep 3
 	screen -dmS IS mono OpenSim.Grid.InventoryServer.exe
 	sleep 3
 	screen -dmS AS mono OpenSim.Grid.AssetServer.exe
 	sleep 3
 	screen -dmS MS mono OpenSim.Grid.MessagingServer.exe
 
         # you can start your regions too, if you like
 	#sleep 45
 	#screen -dmS BWV mono OpenSim.exe 
 
 	;;
 
 	'stop')
 
 	screen -wipe
 
 	for i in MS IS AS GS US
 	do 
                 # you will have to look in the /tmp/screens directory for your username
                 # change whoami to whatever it needs to be
 		kill `ls /tmp/screens/S-whoami/*.$i |
 		 cut -d'/' -f5  |
 		 sed s/[^0-9]//g`
 	done
 
 	screen -wipe
 
 	;;
 
  esac
Personal tools
General
About This Wiki