Startup script linux

= SysVinit Scripts for Linux =

Instructions
Tested on Debian 5. CHUIDS user to opensim user. Supports: start, stop, restart, status

To implement: Type: cat &gt; /etc/init.d/opensim Paste in script from this page Press: CTRL+D Type: chmod +x /etc/init.d/opensim Script should now be located on server and be executable.

Modify header in script to adapt it to your installation folder and user.

Updated script
Unlike Tedd's original script below, this relies on OpenSimulator's own PID functionality to work, so you must uncomment the PIDFile entries in the [Startup] section of OpenSim.ini/Robust.ini and set them to /tmp/OpenSim.exe.pid and /tmp/Robust.exe.pid as appropriate.

This allows us to simplify the script and get better error reporting. Cleanly shutting down OpenSimulator has also been implemented.

The delay between attempting clean shutdown and force shutting down has been doubled to 20 seconds. However, in some cases this still might not be enough. In the future, it would be better to poll for status.

This script is maintained at https://github.com/justincc/opensimulator-tools/blob/master/infrastructure/control/init.d/src/opensim Pull requests welcome!

CentOS/RHEL 6 and older script
= Systemd Service Units for Linux =

CentOS/RHEL 7 and 8 Systemd Service Unit
Notes
 * Should work on CentOS 7.x, CentOS 8.x, RHEL 7.x, RHEL 8.x. Might work on other Redhat-based distros.
 * The "--server" option sets default garbage collection in mono which might be slightly faster for production usage. Using "--desktop" instead should also work and will set the garbage collection system to avoid expanding the heap as much as possible at the expense of slowing down garbage collection a bit.
 * There's a default max timeout of 60 seconds for shutdown. Adjust as needed if that's not long enough on your server.
 * This example doesn't use screen so the OpenSim console will not be available directly.

Setup Usage
 * Create an opensim user (be sure to set shell to /sbin/nologin)
 * Install opensim in /opt/opensim
 * Save the above file as /etc/systemd/system/opensim.service
 * systemctl enable opensim
 * systemctl disable opensim
 * systemctl status opensim
 * systemctl start opensim
 * systemctl stop opensim
 * systemctl restart opensim
 * journalctl -u opensim

= Other OpenSimulator Linux scripts =


 * Tmux - Using tmux, a terminal multiplexer, to run OpenSimulator on server while retaining access to the terminal
 * Ogltree Install Instructions - Adam Frisby's Linux ogltree scripts