Skip to content

Instantly share code, notes, and snippets.

@weslleih
Last active April 4, 2020 15:42
Show Gist options
  • Save weslleih/3013253 to your computer and use it in GitHub Desktop.
Save weslleih/3013253 to your computer and use it in GitHub Desktop.
Teamspeak service for Linux

Assuming you have downloaded and unzipped the latest version of the program in folder /opt/ts3

  • Create a user for the application and disable logging

Ubuntu

adduser --disabled-login

Fedora

adduser -r teamspeak
  • Put the user teamspeak as the owner of the folder
chown -R teamspeak /opt/ts3
  • Download the script below in the folder

Ubuntu

wget -P /etc/init.d/ https://gist.github.com/wesllei/3013253/raw/93d958ecf5f7f2b4ebe46cd21f1e3203a1e30b63/teamspeak

Fedora

wget -P /usr/local/bin/ https://gist.github.com/wesllei/3013253/raw/93d958ecf5f7f2b4ebe46cd21f1e3203a1e30b63/teamspeak
wget -P /lib/systemd/system/ https://gist.github.com/wesllei/3013253/raw/ee67e523801f84f7f2588df31c2aa4a93feccdf6/teamspeak.service
  • Change the file permissions

Ubuntu

chmod 755 /etc/init.d/teamspeak

Fedora

chmod 755 /usr/local/bin/teamspeak
  • And enable the service

Ubuntu

update-rc.d teamspeak defaults

Fedora Make symbolic link

ln -s /lib/systemd/system/teamspeak.service /etc/systemd/system/

Make systemd take notice of it

systemctl daemon-reload

Activate a service immediately

systemctl start teamspeak.service

Enable a service to be started on bootup

systemctl enable teamspeak.service
#! /bin/sh
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="TeamSpeak Server"
NAME=teamspeak
USER=teamspeak
DIR=/opt/ts3
DAEMON=$DIR/ts3server_startscript.sh
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
mount -t tmpfs tmpfs /dev/shm
cd $DIR
sudo -u $USER ./ts3server_startscript.sh $1
[Unit]
Description=Control TeamSpeak server
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/teamspeak
[Install]
WantedBy=multi-user.target
@CRC-Mismatch
Copy link

CRC-Mismatch commented Oct 8, 2016

It should be noted that the user name is weslleih, not wesllei anymore. So, instead the links would be:
wget -P /etc/init.d/ https://gist.github.com/weslleih/3013253/raw/93d958ecf5f7f2b4ebe46cd21f1e3203a1e30b63/teamspeak

and

wget -P /usr/local/bin/ https://gist.github.com/weslleih/3013253/raw/93d958ecf5f7f2b4ebe46cd21f1e3203a1e30b63/teamspeak
wget -P /lib/systemd/system/ https://gist.github.com/weslleih/3013253/raw/ee67e523801f84f7f2588df31c2aa4a93feccdf6/teamspeak.service

@BlueNickDev
Copy link

BlueNickDev commented Jan 30, 2019

root@ermejo:~# systemctl enable teamspeak.service teamspeak.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable teamspeak update-rc.d: error: teamspeak Default-Start contains no runlevels, aborting. root@ermejo:~#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment