In certain situations it is desirable to run a second instance of TFS (or other OTS engine) on the same server (OTS Hosting Service or another server provisioned with our scripts).

Unless you have two different public IP addresses on your server, you cannot run more than one OTS on port 7171. You can, however, use a single login server on port 7171 for two worlds running on different ports. You have to make sure to configure appropriate ports and/or IP addresses in config.lua.

Assuming you already run one instance of TFS using our service unit (using start/stop/restart tfs), it is really easy to manage more than one process this way. Simply pick a new name, such as "tfs2" and create a new file at /etc/systemd/system/tfs2.service with the following content:

 1[Unit]
 2Description=The Forgotten Server
 3After=network-online.target mysql.service
 4
 5[Service]
 6Type=simple
 7ExecStart=/home/otsmanager/forgottenserver/build/tfs
 8WorkingDirectory=/home/otsmanager/forgottenserver
 9Restart=always
10
11[Install]
12WantedBy=default.target

In the above file, you have to customize two lines to point to the proper places:

  1. Change ExecStart= to match the full path to the binary of the second server (e.g. ExecStart=/home/otsmanager/forgottenserver2/theforgottenserver)
  2. Change WorkingDirectory= to match the full path to the directory where your config.lua is located (e.g. WorkingDirectory=/home/otsmanager/forgottenserver2

That's it, now you must reload your systemd user instance. Execute:

 1sudo systemctl daemon-reload

Now you are ready to run. Use the regular commands with a new name of the unit file. If you named the above file tfs2.service then use:

 1sudo systemctl start tfs2
 2sudo systemctl stop tfs2
 3sudo systemctl restart tfs2
 4sudo systemctl status tfs2