Start OpenSim automatically

Everything in this section is done with the limited OpenSim account (maria here)! We assume that on each server boot up, Linux tries to call the file “autostart.sh” in the home directory. This was prepared in the server configuration part (menu “Auto boot” at the respective operating system) of this tutorial. Copy the following script into the empty file “autostart.sh” which was prepared before:

#!/bin/sh
# change to OpenSim bin directory
cd /home/maria/opensim/bin
while :
do
# first run: await completion of startup - later: avoid heavy triggering
sleep 120
# try and ignore error if already exists
running=`ps ax | grep OpenSim.exe | grep -v grep`
if [ -z "$running" ]
  then
    tmux new-session -d -s term -n OpenSim 'env LANG=C mono OpenSim.exe'
  else
    tmux new-window -n OpenSim -t term:0 'env LANG=C mono OpenSim.exe' 2> /dev/null
fi
done

This script tests in a loop if OpenSim is running, and restarts it if crashed. The sleep command causes the following commands to be executed only when the computer has started up completely, and it reduces the system load of the loop. The workaround “env LANG = C” forces OpenSim to ignore national language settings (documentation). Be aware of the very special backward oriented quotation marks in the line with “running=”, as in the Bash programming language ` has a different meaning than ´ or “.

Set execute permissions: chmod u+x autostart.sh

How to use tmux

With tmux, the OpenSim application started in the background can be brought into the console, and also pushed back into the background. The advantage is that the OpenSim console can be reached without having to quit the background program with “killall mono” and to restart OpenSim in the console. If you push OpenSim back into the background before closing the console, you can close the console without stopping OpenSim.

Bring OpenSim into the console:
=> Use the OpenSim account verwenden, here in this tutorial “maria”.
=> Type the following command: tmux attach

Release OpenSim to the background:
=> Type the key code ctrl-B D

Hint: tmux is a very complex tool with lots of additional features, described for example in the Hawk Host Blog:
Part 1 and Part 2


Continued: Set up more regions in the Regions.ini

Scroll to Top