Run as a service

As a service, the server starts with the computer, starts again by itself after an update or a crash, and keeps running when you close the console. The setup assistant installs it: answer y to its last question, or run it again with --setup --install-service yes.

If you move the server's folder, run the assistant again: the service points to the old place.

Linux (systemd)

The assistant writes /etc/systemd/system/nodeworld-server.service, enables it and starts it. That needs administrator rights: sudo asks for your password. The service runs as the user who installed it, with the same server-config.yaml.

bash
systemctl status nodeworld-server        # state
journalctl -u nodeworld-server -f        # log, live
sudo systemctl restart nodeworld-server  # after a change of server-config.yaml
sudo systemctl stop nodeworld-server     # stop

systemd starts the server again when it stops by itself, except after a configuration error (exit code 2): fix server-config.yaml, then restart the service.

To remove the service:

bash
sudo systemctl disable --now nodeworld-server
sudo rm /etc/systemd/system/nodeworld-server.service
sudo systemctl daemon-reload

Ubuntu, Debian and Raspberry Pi OS have systemd. Without it (WSL without systemd, some containers), the assistant says so and the server runs in the console: keep it running with tmux or screen.

Windows

The assistant installs the Windows service NodeWorld Server and starts it. Windows asks for administrator rights (User Account Control): choose Yes. The assistant also:

  • runs the service as Local Service, an account with few rights, and lets it write the server's folder (updates, world files, logs);
  • adds a Windows Defender Firewall rule for the server, so the port is open on this machine;
  • has Windows start the service again 5 seconds after it stops by itself (after an update or a crash).

A service has no window: its log goes to the Logs folder next to NodeWorld.Server.exe, one file per day, the last 14 kept.

In PowerShell:

powershell
Get-Service NodeWorldServer       # state
Restart-Service NodeWorldServer   # after a change of server-config.yaml (as administrator)
Stop-Service NodeWorldServer      # stop (as administrator)

You can also open Services (services.msc) and find NodeWorld Server.

To remove the service, in a PowerShell as administrator:

powershell
Stop-Service NodeWorldServer
sc.exe delete NodeWorldServer
Remove-NetFirewallRule -DisplayName "NodeWorld Server"