Forum

Results 1 to 4 of 4
  1. #1
    Join Date
    October 2015
    Posts
    1

    Using systemd to start teamspeak

    Just a quick start script for those using systemd, I have tested this and it works, just change the locations to point to your install. The file should placed in the /etc/systemd/system directory, as an example if we used /etc/systemd/system/teamspeak.service we could then do systemctl start teamspeak and systemctl enable teamspeak so that way teamspeak starts if the server reboots.

    Code:
    [Unit]
    Description=Teamspeak Start Script
    After=network.target
    
    [Service]
    User=teamspeak
    WorkingDirectory=/home/teamspeak/teamspeak3-server_linux-amd64
    Type=forking
    ExecStart=/home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh start
    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
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

  2. #2
    Join Date
    February 2012
    Location
    Germany
    Posts
    576
    Actually, it's possible to write a much easier and much cleaner unitfile for systemd. This also enables systemd to grab the server console output (it's discarded with the script variant), and it enables systemd to monitor the running server, so it restarts it if it terminates prematurely.

    Considering you are using the 64-bit server, start it as user teamspeak3 and it is installed into /opt/teamspeak3, you can use a unit file like this:
    Code:
    [Unit]
    Description=TeamSpeak 3 Server
    Documentation=http://www.teamspeak.com/?page=literature
    After=network.target
    
    [Service]
    User=teamspeak3
    UMask=0027
    WorkingDirectory=/opt/teamspeak3
    ExecStart=/opt/teamspeak3/ts3server_linux_amd64 inifile=/opt/teamspeak3/ts3server.ini
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    If you don't use an ini file, omit the parameter inifile=... from the ExecStart line.

    Whole *.spec file for *.rpm file creation on Fedora/Centos:
    https://www.wombaz.de/uploads/2015/0...k3-server.spec
    Using a rpm is much easier than installing manually from a *.tar.gz with binaries, especially when updating the server. Server downtime with rpm update: 10 seconds.
    Last edited by Schlumpi; April 16th, 2016 at 01:42 AM.

  3. #3
    Join Date
    November 2015
    Posts
    1
    Looks like the forking entry in the first example is very important. Without it my teamspeak service would fail to start. Thank you for this script example. I am using it right now!
    Last edited by roachware; March 11th, 2016 at 12:26 AM.

  4. #4
    Join Date
    May 2019
    Posts
    4
    I am no expert, but I am using this systemd config. We are using a MySQL DB, so I require a running mysql service and also use the inifile. Thanks for the above posts, for getting me started.

    Code:
    [Unit]
    Description=TeamSpeak 3 Server
    Requires=mysql.service
    After=network.target
    After=mysql.service
    
    [Service]
    Type=forking
    User=teamspeak3
    Group=teamspeak3
    WorkingDirectory=/opt/teamspeak3-server/
    ExecStart=/opt/teamspeak3-server/ts3server_startscript.sh start inifile=/opt/teamspeak3-server/ts3server.ini
    ExecStop=/opt/teamspeak3-server/ts3server_startscript.sh stop
    ExecReload=/opt/teamspeak3-server/ts3server_startscript.sh restart
    PIDFile=/opt/teamspeak3-server/ts3server.pid
    RestartSec=15
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: March 15th, 2018, 12:09 PM
  2. Fedora 16 Systemd startup script
    By slyone in forum Linux / FreeBSD
    Replies: 1
    Last Post: December 17th, 2013, 06:04 AM
  3. Replies: 1
    Last Post: May 6th, 2013, 09:05 AM
  4. [Resolved] Updater: disable button Start Teamspeak if updater is going to start it automatically
    By shadow_lmd in forum Suggestions and Feedback
    Replies: 9
    Last Post: January 31st, 2012, 01:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •