Supervisor
Administrator
- Apr 27, 2015
- 1,863
- 2,546
- 335
Hey there,
as there are so many questions about scripts for Teamspeak 3 Servers.. I will provide some for you. They will include the AccountingServerEmulator for the TS3 crack, too. This scripts are tested in a linux environment, only!
So lets get started, follow the steps to install the scripts (I work with nano, if you don't have nano, install it):
Autostart script for ts3-server and the AccountingServerEmulator-Linux (sudo/root needed!):
TS3 crash script:
as there are so many questions about scripts for Teamspeak 3 Servers.. I will provide some for you. They will include the AccountingServerEmulator for the TS3 crack, too. This scripts are tested in a linux environment, only!
So lets get started, follow the steps to install the scripts (I work with nano, if you don't have nano, install it):
Autostart script for ts3-server and the AccountingServerEmulator-Linux (sudo/root needed!):
- type cd /etc/init.d; nano teamspeak.sh
- paste the following code into the created file, change the marked lines (*) to your needs
Code:
#!/bin/sh ### BEGIN INIT INFO # Provides: teamspeak3 # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: # Description: Teamspeak 3 Server # ### END INIT INFO#!/bin/sh case "$1" in start) su ts3 -c "/home/ts3/teamspeak3-server_linux-amd64/./AccountingServerEmulator-Linux" (*) sleep 10 su ts3 -c "/home/ts3/teamspeak3-server_linux-amd64/./ts3server_startscript.sh start" (*) ;; stop) su ts3 -c "/home/ts3/teamspeak3-server_linux-amd64/./ts3server_startscript.sh stop" (*) su ts3 -c "/home/ts3/teamspeak3-server_linux-amd64/./AccountingServerEmulator-Linux stop" (*) ;; *) echo "$0 (start|stop)" exit 1 ;; esac exit 0
- save the file with Ctrl-x
- type chmod +x teamspeak.sh; update-rc.d teamspeak.sh defaults
- You are done! Everytime your server restarts, your ts server and your accounting server will start, too!
TS3 crash script:
- navigate into your teamspeak directory, for me it would be cd /home/ts3/teamspeak3-server_linux-amd64
- type nano tscc.sh (ts crash checker)
- Change the line ending with (*) to your needs and delete the (*) afterwards
- paste the code below (if you use 32bit, change the ts3server_linux_amd64 to 32)
Code:
#!/bin/bash TEAMSPEAK=`ps ax | grep ts3server_linux_amd64 | grep -v grep | wc -l` if [ $TEAMSPEAK -eq 1 ] then exit else /home/ts3/teamspeak3-server_linux-amd64/./ts3server_startscript.sh start (*) fi
- save the file
- type chmod +x tscc.sh
- type crontab -e
- navigate to the bottom of the file
- type */2 * * * * /home/ts3/teamspeak3-server_linux-amd64/./tscc.sh (change the path to your needs. You may change the time, also)
- exit with CTRL-X
- You are done! The script will check every two minutes, whether your ts-server is running, if not.. it will restart it.
Code:#! /bin/bash case "$(pidof AccountingServerEmulator-Linux | wc -w)" in 0) echo "Restarting AccountingServer: $(date)" >> /usr/teamspeak3/auto_log.txt /usr/teamspeak3/AccountingServerEmulator-Linux & ;; 1) # all ok ;; *) echo "Removed double AccountingServer: $(date)" >> /usr/teamspeak3/auto_log.txt kill $(pidof AccountingServerEmulator-Linux | awk '{print $1}') ;; esac
Last edited: