Screen

From OpenSimulator

Revision as of 07:47, 5 November 2024 by Tampa (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Contents

GNU Screen

GNU Screen is a powerful terminal multiplexer that allows you to create, manage, and control multiple terminal instances (or windows), each running a separate program, from a single screen. With Screen, you can detach sessions from the terminal so that they continue running in the background, and later reattach to them. This feature is especially useful for long-running processes that should not be interrupted. A comprehensive guide can be found here: Screen.

Many users utilize GNU Screen to run OpenSimulator, as it provides an effective way to organize multiple sessions while keeping track of them all.

Installation

To install GNU Screen, use the following command:

#!/bin/bash
sudo apt-get install screen

You can check the installed version with the following command:

#!/bin/bash
screen -v

Starting Sessions

To start a new OpenSim session with GNU Screen, you can use the following commands:

#!/bin/bash
# Start a new OpenSimulator 0.9.3 instance.
screen -fa -S OpenSim -d -U -m dotnet OpenSim.dll
# Start an old OpenSimulator 0.9.2 instance.
screen -fa -S OpenSim -d -U -m mono OpenSim.exe
# Start a new Robust 0.9.3 server.
screen -fa -S ROBUST -d -U -m dotnet Robust.dll
# Start an old Robust 0.9.2 server.
screen -fa -S ROBUST -d -U -m mono Robust.exe

To detach the OpenSim session, press the key combination `Ctrl+a d`.

To reconnect to an existing OpenSim session, use the command:

#!/bin/bash
screen -r OpenSim

Ending Sessions

To safely shut down OpenSimulator or Robust, you can use the following commands:

#!/bin/bash
# Safely shut down OpenSimulator. The character ^M stands for Return/Enter.
screen -S OpenSim -p 0 -X eval "stuff 'shutdown'^M"
# Safely shut down Robust.
screen -S ROBUST -p 0 -X eval "stuff 'shutdown'^M"

For safer handling in case the sessions are not found, you can use these commands:

#!/bin/bash
# Safely shut down OpenSimulator and issue a warning if it is not found.
screen -S OpenSim -p 0 -X eval "stuff 'shutdown'^M" || echo "OpenSim not found."
# Safely shut down Robust and issue a warning.
screen -S ROBUST -p 0 -X eval "stuff 'shutdown'^M" || echo "Robust not found."

If an OpenSimulator or Robust process has crashed and you need to kill the session, you can use the following commands (note that any data that would have been written during shutdown will be lost):

#!/bin/bash
# Kill the OpenSimulator screen.
screen -X -S OpenSim kill
# Kill the Robust screen.
screen -X -S ROBUST kill

Conclusion

GNU Screen is an essential tool for managing multiple terminal sessions and is particularly well-suited for applications like OpenSimulator. It provides an easy way to detach, share, and log sessions. With Screen, you can significantly improve your workflows and maintain control over long-running processes.

Personal tools
General
About This Wiki