Version 1.0

This commit is contained in:
Marcin Wozniak 2019-02-01 19:09:53 +01:00
parent 44d27c061d
commit f17237c519
3 changed files with 74 additions and 0 deletions

3
backup Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sudo mkdir -p /BACKUP/
cp -rp /opt/ /BACKUP/opt-$(date +"%d-%m-%Y")/

11
backup-remove Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
sudo mkdir -p /BACKUP/
cp -rp /opt/ /BACKUP/opt-$(date +"%d-%m-%Y")/
cd /BACKUP/
touch /BACKUP/tmp /BACKUP/stay
echo "$(ls -lut /BACKUP/ | sed -e '/total/d' | awk {'print $9'})" > /BACKUP/tmp
echo "$(ls -lut /BACKUP/ | sed -e '/total/d' | awk {'print $9'})" | tail -2 > /BACKUP/stay
grep -vf /BACKUP/stay /BACKUP/tmp > /BACKUP/deleted
sudo rm -rf $(cat /BACKUP/deleted)
sudo rm -rf /BACKUP/tmp /BACKUP/stay /BACKUP/deleted

60
update Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
LINK="http://files.teamspeak-services.com/releases/server/3.6.0/teamspeak3-server_linux_amd64-3.6.0.tar.bz2"
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
#Tworzenie BACKUPU
sudo mkdir -p /BACKUP/
cp -rp /opt/ /BACKUP/opt-$(date +"%d-%m-%Y")/
#POBIERANIE NAJNOWSZEJ WERSJI TS3
wget $LINK --quiet
#ROZPAKOWANIE TS3 & SKOPIOWANIE PLIKOW
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
#USUNIECIE BZDET
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