2

So I'm quite new to linux but I'm starting to understand it. I have a Ubuntu Server 12.04 system, fresh install, and I installed a teamspeak 3 server on it:

$ sudo useradd teamspeak
(provided user info and password)
$ su teamspeak
(entered password)
$ cd /home/teamspeak
$ wget http://ftp.4players.de/pub/hosted/ts3/releases/3.0.10.3/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz
(download teamspeak.tar.gz)
$ tar -zxvf teamspeak3-server_linux-amd64-3.0.10.3.tar.gz
(unpacked the file to teamspeak3-server_linux-amd64)
$ mv teamspeak3-server_linux-amd64 server
(server is no located in /home/teamspeak/server)
$ cd ./server
$ ./ts3server_minimal_runscript.sh createinifile=1
(initialized the server)
$ ./ts3server_startscript.sh start
(started the server)

Now when I reboot my server (e.g. $ sudo reboot) the server doesn't start up. Obviously because I haven't configured anything in /etc/init.d but I have no idea how to do this.

I want the server to start like it does with the /home/teamspeak/server/ts3server_startscript.sh start script, ran by the user teamspeak.

I followed several guides but they didn't work. Can someone help me?

3 Answers 3

5

I recommend creating an Upstart script.

First you want to create the script itself: sudo nano /etc/init/ts-server.conf

Copy and paste this skeleton and make any changes you need:

# description "start and stop the TS server"

console log # Log events to console

exec start-stop-daemon --start --chdir /home/teamspeak/server/ --chuid teamspeak \
    --exec /home/teamspeak/server/ts3server_startscript.sh start

 start on runlevel [2345] # Tell when to start
stop on runlevel [^2345] # Tell when to stop

respawn # Block excess respawn
respawn limit 20 5 # Ditto

Save that file, go to /home/teamspeak/server/ and create a file ts3server_upstart.sh
Contents:

#!/bin/bash
/home/teamspeak/server/ts3server_startscript.sh start

Save, mark it as execuatable, done! It'll start on boot, and can be manually started/stopped/restarted using sudo service ts-server start, sudo service ts-server stop, and sudo service ts-server restart, respectively.

EDIT: This may not actually STOP TeamSpeak. I do not know enough about TS and starting to tell you whether it will or will not.

7
  • Can you explain what you did. I'm a bit of a noob and I like to understand what I'm doing. Thanks for your answer though, I'll give it a go.. Commented Jan 11, 2014 at 22:36
  • Basically the first part is creating something known as Upstart, Ubuntu's program for launching stuff at boot. The second part is creating a script for Upstart to launch. I will edit with comments. Commented Jan 11, 2014 at 22:41
  • Thanks for editing with comments, it doesn't quite work.. When I reboot the server, ssh and execute htop, I don't see a process executing from teamspeak, neither do I see a process that is the teamspeak server, and I cannot connect to it from my desktop/laptop. When I run ts3server_startscript.sh start I can, and when I run sudo ./ts3server_startscript.sh stop it stops. When I run sudo service ts-server start|stop|restart it says it starts but doesn't and gives errors with stop or restart: stop: Unknown instance: and stop: Unknown instance: ts-server start/running, process 1344. Commented Jan 11, 2014 at 22:51
  • hmm. that is interesting, Commented Jan 11, 2014 at 22:54
  • edited post. try the new version. Commented Jan 11, 2014 at 22:55
5

This is the upstart script I use, mostly a rip off of Mew's:

description "Teamspeak 3"

console log # Log events to console

setuid teamspeak
setgid teamspeak

exec /opt/teamspeak/ts3server_minimal_runscript.sh

start on runlevel [2345] # Tell when to start
stop on runlevel [^2345] # Tell when to stop

respawn # Block excess respawn
respawn limit 20 5 # Ditto

It requires upstart 1.4 or higher for setuid/setgid, but Ubuntu 12.04 provides that. If you don't have that you can just change the exec line to be exec su -s /bin/sh -c /opt/teamspeak/ts3server_minimal_runscript.sh teamspeak instead.

The main difference is that it uses ts3server_minimal_runscript.sh instead, which doesn't fork. ts3server_startscript.sh is meant to be used as a sort of init script so it forks - which isn't necessary for upstart. When used with upstart it means that you can't do commands like service ts-server status or even service ts-server stop. With this script you can.

-1

I have followed step by step in this tutorial, everything is describe, how to install and configure TeamSpeak3 server with MySQL - MariaDB on Debian/Ubuntu. http://terminal28.com/how-to-install-and-configure-teamspeak3-server-linux-debian-ubuntu/

1
  • Welcome to Unix & Linux! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Commented Jan 25, 2015 at 8:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.