2019-02-01 19:09:53 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-05 22:32:37 +01:00
|
|
|
VERSION=$(curl http://files.teamspeak-services.com/releases/server/ | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' | sort | uniq | sort --version-sort --field-separator=. | tail -n1)
|
|
|
|
LINK="http://files.teamspeak-services.com/releases/server/$VERSION/teamspeak3-server_linux_amd64-$VERSION.tar.bz2"
|
2019-02-01 19:09:53 +01:00
|
|
|
|
|
|
|
service_ts3="ts3server serveradmin"
|
|
|
|
ts3local="/opt/teamspeak/"
|
|
|
|
|
|
|
|
mkdir -p $ts3local
|
|
|
|
if (( $(ps -ef | grep -v grep | grep "$service_ts3" | wc -l) > 0))
|
|
|
|
then
|
|
|
|
alive_ts3=1
|
|
|
|
else
|
|
|
|
alive_ts3=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if (alive_ts3=1)
|
|
|
|
then
|
|
|
|
systemctl stop teamspeak
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (alive_ts3=0)
|
|
|
|
then
|
2019-02-01 19:51:23 +01:00
|
|
|
#CREATE BACKUP
|
2019-02-01 19:09:53 +01:00
|
|
|
sudo mkdir -p /BACKUP/
|
|
|
|
cp -rp /opt/ /BACKUP/opt-$(date +"%d-%m-%Y")/
|
|
|
|
|
2019-02-01 19:51:23 +01:00
|
|
|
#DOWNLOAD NEWER VERSION OF TEAMSPEAK
|
2019-02-01 19:09:53 +01:00
|
|
|
wget $LINK --quiet
|
|
|
|
|
2019-02-01 19:51:23 +01:00
|
|
|
#UNTAR AND COPY FILES
|
2019-02-01 19:09:53 +01:00
|
|
|
tar -jxf teamspeak3-server_linux_amd*.tar.bz2
|
|
|
|
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/CHANGELOG $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/doc $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/ts3server $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/ts3server_startscript.sh $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/sql $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/redist $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/serverquerydocs $ts3local
|
|
|
|
cp -rp /opt/teamspeak3-server_linux_amd64/libts3_ssh.so $ts3local
|
|
|
|
|
2019-02-01 19:51:23 +01:00
|
|
|
#REMOVE FILES
|
2019-02-01 19:09:53 +01:00
|
|
|
rm -rf teamspeak3-server_linux_amd*.tar.bz2 teamspeak3-server_linux_amd64*
|
|
|
|
|
|
|
|
#START TEAMSPEAK
|
|
|
|
systemctl start teamspeak
|
|
|
|
|
|
|
|
if (( $(ps -ef | grep -v grep | grep "$service_ts3" | wc -l) > 0))
|
|
|
|
then
|
|
|
|
echo -e "\e[32m$service_ts3 is running!!!\e[0m"
|
|
|
|
else
|
|
|
|
echo -e "\e[31m$service_ts3 is not running!!!\e[0m"
|
|
|
|
sleep 5
|
|
|
|
systemctl start teamspeak
|
|
|
|
fi
|
|
|
|
fi
|