How to create a TeamSpeak³ Autostart Skript on a Linux System
After we've created our TeamSpeak³ Server in this Tutorial , we perhaps want to let that server auto- start on system bootup. To do so, we first create a file namend "teamspeak" in the directory /etc/init.d.
You can do this with the following command:
touch /etc/init.d/teamspeak
After that, we make the new- created file executeable. We do this with:
chmod +x /etc/init.d/teamspeak
After that, we're going to edit the content of this file, so we now open it with an editor (I've choosen nano):
nano /etc/init.d/teamspeak
or on other Systems perhaps with vi or vim:
vi /etc/init.d/teamspeak
When the file is opened, we paste the following content:
#!/bin/sh
# chkconfig: 2345 99 01
# description: Teamspeak 3 Server
### BEGIN INIT INFO
# Provides: teamspeak3
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Teamspeak 3 Server
### END INIT INFO
USER="ts3"
DIR="/home/ts3"
case "$1" in
start)
su $USER -c "${DIR}/ts3server_startscript.sh start"
;;
stop)
su $USER -c "${DIR}/ts3server_startscript.sh stop"
;;
restart)
su $USER -c "${DIR}/ts3server_startscript.sh restart"
;;
status)
su $USER -c "${DIR}/ts3server_startscript.sh status"
;;
*)
echo "Benutze: `basename $0` {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
We have to configure these variables to our user, and the directory, the teamspeak-server runs with:
USER="ts3"
DIR="/home/ts3"
When you've finished that step, we now tell the system that it should start the skript on bootup. To do so we run the following Command : (On RedHat based Systems:
chkconfig teamspeak on
on Debian/Ubuntu:
update-rc.d teamspeak defaults
If you don't want to reboot your system now, you can test the skript manually with the following command:
/etc/init.d/teamspeak start/stop/status
If the specified option gets applied to the TeamSpeak³ Server, you've configured everything fine.