Docs / Multiplayer / Dedicated server
Running as a service
On this page
The start scripts start.sh and start.cmd are meant for services: they ask nothing.
Linux (systemd)#
- Create a user for the server, for example
openomsi, and unpack the server into/opt/openomsi-server. - Run it once by hand to write
server.cfg, then edit it. - Create
/etc/systemd/system/openomsi-server.service:
[Unit]
Description=openOMSI dedicated server
After=network-online.target
Wants=network-online.target
[Service]
User=openomsi
WorkingDirectory=/opt/openomsi-server
ExecStart=/opt/openomsi-server/start.sh /srv/omsi2 /opt/openomsi-server/server.cfg
Restart=on-failure
RestartSec=10
KillSignal=SIGINT
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target- Start it and enable it at boot:
sudo systemctl daemon-reload
sudo systemctl enable --now openomsi-server
journalctl -u openomsi-server -fThe players' buses and the owner's ban list live in the service user's ~/.openomsi.
Windows#
Use the Task Scheduler, which every Windows has:
- Open Task Scheduler → Create Task.
- General: a name, Run whether user is logged on or not.
- Triggers: At startup.
- Actions: Start a program, program
C:\openomsi-server\start.cmd, arguments"C:\path\to\OMSI 2", start inC:\openomsi-server. - Settings: untick Stop the task if it runs longer than. Optionally If the task fails, restart every 1 minute.
Docker (Linux)#
The repository has a container setup in docker/server (see its README.md):
cd docker/server
cp .env.example .env # set OMSI_DIR to your OMSI 2 folder
mkdir config
cp server.cfg.example config/server.cfg
docker compose up -d --build
docker compose logs -fThe OMSI 2 folder is mounted read-only. config/ holds server.cfg, content/ the packed maps, and a volume keeps the players' buses.
The server is ready when http://<address>:27025/status answers (docker ps shows healthy).
Docker keeps the log itself: five files of 20 MB.
Something wrong or missing? Fix it on GitHub or open an issue.