Test Page

From OpenSimulator
Revision as of 19:48, 23 November 2008 by imported>BlueWall (→Useful Scripts)
Jump to navigationJump to search

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

<source lang="bash">

  1. !/bin/sh
  2. THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
  3. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  4. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  5. DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  6. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  7. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  8. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  9. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  10. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  11. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12. Adjust To Your System:
  13. Sample Cron Entry: Runs Each Minute 24/7/365
  14. */1 * * * * exec /opt/opensim/scripts/oswatchdog
  15. Where Does Your OpenSim Installation Live?

BASE="/opt/opensim"

  1. Where Do You Run OpenSim.exe From?

RUN="$BASE/production/bin"

  1. Where Do You Want To Log Events To?

LOG="$BASE/log"

  1. Where Is Your Screen Binary?

SCREEN="/usr/bin/screen"


  1. if the file exist, opensim wont be restarted
  2. Sacha Magne

LOCKFILE="/tmp/norun.opensim"

if [ -f "$LOCKFILE" ]; then

 echo $LOCKFILE "found. no restart"
 exit

fi


  1. Check For For Our Screen Process, Named OSG

running=`ps ax|grep OSG|grep -v grep`

  1. 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

  1. All Done Till Next Time


o