Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
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.. –  Jochem Kuijpers Jan 11 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. –  Mew Jan 11 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. –  Jochem Kuijpers Jan 11 at 22:51
    
hmm. that is interesting, –  Mew Jan 11 at 22:54
    
edited post. try the new version. –  Mew Jan 11 at 22:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.