Systemd Unit
Jump to navigation
Jump to search
This mainly applies to CentOS 7 and Ubuntu 18.04+, there are advantages to using this method as it also enables monitoring of the TeamSpeak 3 Server as well as starting the TeamSpeak instance on boot.
Copy the following in to a systemd unit file of your choosing, we'll use /etc/systemd/system/teamspeak.service, you will need to change the lines WorkingDirectory, ExecStart, ExecStop and ExecReload if you installed the server in a different folder and the user= line if you made a UNIX user other than "teamspeak".
[Unit] Description=TeamSpeak3 Server Wants=network-online.target After=syslog.target network.target [Service] WorkingDirectory=/home/teamspeak/teamspeak3-server_linux-amd64/ User=teamspeak Type=forking ExecStart=/home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh start initfile=ts3server.ini ExecStop=/home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh stop ExecReload=/home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh restart PIDFile=/home/teamspeak/teamspeak3-server_linux-amd64/ts3server.pid [Install] WantedBy=multi-user.target
After you've saved the file you need to enable the unit by running :
systemctl enable teamspeak
As a bonus, you can now use systemd to start, stop and reload your server by using
systemctl start teamspeak systemctl stop teamspeak systemctl reload teamspeak