FloFaber.com

TeamSpeak3 server systemd service

It's all pretty easy.

  1. Create a new service file in /etc/systemd/system/.

    # sudo nano /etc/systemd/system/ts3server.service
  2. The content of the file. Make sure you change it to your needs.

    [Unit]
    Description=TS3 Server
    After=network-online.target
    [Service]
    User=ts3
    Type=simple
    WorkingDirectory=/home/ts3/server
    ExecStart=/home/ts3/server/ts3server
    Restart=always
    RestartSec=15s
    [Install]
    WantedBy=multi-user.target
  • User=ts3 specified the user as which the service should run. In my case it's ts3.
  • WorkingDirectory= has to be set to the servers directory.
  • ExecStart= is the path to the ts3server binary.
  1. daemon-reload and test
    # sudo systemctl daemon-reload
    # sudo systemctl start ts3server.service
    # sudo systemctl status ts3server.service
    ts3server.service - TS3 Server
      Loaded: loaded (/etc/systemd/system/ts3server.service; disabled; vendor preset: enabled)
      Active: active (running) since Wed 2022-11-23 15:42:18 UTC; 16min ago
    Main PID: 21401 (ts3server)
       Tasks: 21 (limit: 38082)
      Memory: 17.1M
         CPU: 14.447s
      CGroup: /system.slice/ts3server.service
              `-21401 /home/ts3/server/ts3server
    Nov 23 15:42:19 ts ts3server[21401]: 2022-11-23 15:42:19.679554|INFO    |VirtualServerBase|1  |listening on 0.0.0.0:9987, [::]:9987
    Nov 23 15:42:19 ts ts3server[21401]: 2022-11-23 15:42:19.680112|INFO    |Query         |   |listening for query on 0.0.0.0:10011, [::]:10011
    Nov 23 15:42:19 ts ts3server[21401]: 2022-11-23 15:42:19.680421|INFO    |Query         |   |listening for ssh query on 0.0.0.0:10022, [::]:10022
    Nov 23 15:42:19 ts ts3server[21401]: 2022-11-23 15:42:19.680612|INFO    |Query         |   |listening for http query on 0.0.0.0:10080, [::]:10080
    Nov 23 15:42:19 ts ts3server[21401]: 2022-11-23 15:42:19.680765|INFO    |CIDRManager   |   |updated query_ip_allowlist ips: 127.0.0.1/32, ::1/128,
    ...

Here is some documentation on service files.