Linux – Running Teamspeak server at startup and shutting down teamspeak at shutdown

initlinuxshutdownteamspeakUbuntu

I'm new to linux, and i have a Teamspeak 3 server on a Ubuntu server. I would like to make the server auto start and stop when the system boots and shuts down. I understand that i need to make scripts in the /etc/init. My question is how would i write such a script? I'm trying to make it nice and simple. Below is what I have written to try to make this possible.

inside /etc/init i have a file called teamspeak3.conf, in that file I have the following

script
start
/home/teamspeak3-user/teamspeak/ts3server_startscript.sh start

 stop
      /home/teamspeak3-user/teamspeak/ts3server_startscript.sh stop

end script

Is this right? Ive done some reading and i just don't understand what to do. I'm completely lost. Thanks guys.

Best Answer

If you have a script located in /etc/init.d/ then you are pretty much set to go.

Issue one of these commands (depending on your system).

systemctl enable myscript

chkconfig myscript on

When you issue the shutdown command, a SIGTERM is sent to all running process, and is the default graceful shutdown command.

The server should handle that on its own.

Related Question