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 the 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 only to be executed 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" if not already done.
How to use tmux
With tmux the program is started in the background. If you want to access the command line of that program, you can bring it into the actual console. If your work is ready, with a key shortcut you can release the command line from the console, without the need to stop program execution. It will work further in the background, and will not stop if you close the console.
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
Continued: Set up more regions in the Regions.ini