Skip to content

Simple server management

Daniel Speichert edited this page May 17, 2020 · 4 revisions

When you log in as otsmanager, you will see instructions like this:

===================   TFS commands   ===================
 If you run TFS with the following commands, it will auto restart.
  Enable auto-start on boot:  sudo systemctl enable tfs
 Disable auto-start on boot:  sudo systemctl disable tfs
                  Start TFS:  sudo systemctl start tfs
                   Stop TFS:  sudo systemctl stop tfs
                Restart TFS:  sudo systemctl restart tfs
        Check status of TFS:  systemctl status tfs
          Show full TFS log:  journalctl -u tfs (q to exit)
         Follow TFS console:  journalctl -u tfs -f (CTRL+C to stop)

===================  Useful commands   ===================
Update TFS to latest master:  updatetfs
      Show service due date:  duedate
             Show server IP:  serverip
               Share a file:  transfer path/to/file

Initially, when your service is freshly installed, TFS is not running. It is also not set up to launch on boot.

It is highly recommended that you enable start on boot so that your TFS launches automatically if your machine reboots!

If you use our commands which launch TFS (or any other engine) as a service, it will automatically restart if the process crashes.

Therefore, you should first enable tfs:

otsmanager@176-31-89-137:~$ sudo systemctl enable tfs Created symlink from /etc/systemd/system/default.target.wants/tfs.service to /etc/systemd/system/tfs.service.

Then you can start tfs:

otsmanager@176-31-89-137:$ sudo systemctl start tfs
otsmanager@176-31-89-137:
$ sudo systemctl status tfs ● tfs.service - The Forgotten Server
Loaded: loaded (/etc/systemd/system/tfs.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2015-12-18 22:59:15 CET; 22min ago
Main PID: 18621 (screen)
CGroup: /system.slice/tfs.service

Dec 18 22:59:13 176-31-89-137.spigu.net systemd[5923]: Starting The Forgotten Server...
Dec 18 22:59:15 176-31-89-137.spigu.net systemd[5923]: Started The Forgotten Server.

You can start following logs in realtime:

otsmanager@176-31-89-137:~$ journalctl -u tfs -f -- Logs begin at Mon 2015-12-14 09:12:51 BRST. --
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:25.510] > Unserialization time: 0.163 seconds.
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:25.510] >> Checking world type... Open PvP
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:25.510] >> Starting to dominate the world... done.
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:25.510] >> Initializing game state and binding services...
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:27.402] > Global IP address: 176.31.82.127
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:27.403] > Bound ports: 7171 7172
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:27.403] >> Everything smells good, server is starting up...
Dec 14 09:39:30 176-31-82-127 tfs[2913]: [12:39:28.403] >> Forgotten server Online!

Customizing datapack/executable path

Chances are, you don't want to run the default TFS installation. You have two options:

  1. Delete /home/otsmanager/forgottenserver and put your datapack in the same place and the executable as /home/otsmanager/forgottenserver/build/tfs OR
  2. Reconfigure tfs.service to reflect your directory and executable file.

In order to go with the second option, you should edit /etc/systemd/system/tfs.service and set up working directory and binary path.

otsmanager@176-31-89-137:~$ sudo mcedit /etc/systemd/system/tfs.service

Change the following two lines to reflect your path and binary

ExecStart=ExecStart=/home/otsmanager/ots/theforgottenserver
WorkingDirectory=/home/otsmanager/ots

Save the file (F2) and exit mcedit (F10).

Now you need to reload systemd configuration:

otsmanager@176-31-89-137:~$ sudo systemctl daemon-reload

Now you can start the server in the regular way again:

otsmanager@176-31-89-137:~$ sudo systemctl start tfs

Clone this wiki locally