Browse Source

Updated backup feature

Backup feature now works better. Does not use the full path in the
archive anymore. Also fixed the exclusions not working correctly meaning
it was backing up any previously created backups
pull/30/head
Daniel Gibbs 12 years ago
parent
commit
d00acd9c7e
  1. 4
      CounterStrike/csserver
  2. 4
      CounterStrikeGlobalOffensive/csgoserver
  3. 4
      CounterStrikeSource/cssserver
  4. 4
      DayOfDefeatSource/dodsserver
  5. 4
      HalfLife2Deathmatch/hl2dmserver
  6. 4
      KillingFloor/kfserver
  7. 4
      Left4Dead2/l4d2server
  8. 47
      Mumble/mumbleserver
  9. 6
      NaturalSelection2/ns2server
  10. 4
      NoMoreRoomInHell/nmrihserver
  11. 4
      RedOrchestra/roserver
  12. 4
      TeamFortress2/tf2server
  13. 7
      TeamSpeak3/ts3server
  14. 48
      TheHiddenSource/thsserver
  15. 4
      UnrealTournament2004/ut2k4server
  16. 4
      UnrealTournament99/ut99server

4
CounterStrike/csserver

@ -33,7 +33,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/cstrike/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -218,7 +218,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
CounterStrikeGlobalOffensive/csgoserver

@ -34,7 +34,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/csgo/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -219,7 +219,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
CounterStrikeSource/cssserver

@ -34,7 +34,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/cstrike/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -219,7 +219,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
DayOfDefeatSource/dodsserver

@ -34,7 +34,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/dod/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password ${servercfg} | sed 's/rcon_password //g'|sed 's/"//g')
@ -218,7 +218,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
HalfLife2Deathmatch/hl2dmserver

@ -34,7 +34,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/hl2mp/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -219,7 +219,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
KillingFloor/kfserver

@ -24,8 +24,8 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
backupdir="${rootdir}/backups"
compressedmapsdir="${rootdir}/Maps-Compressed"
backupdir="backups"
# Server Details
servicename="kf-server"
@ -286,7 +286,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
Left4Dead2/l4d2server

@ -34,7 +34,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/left4dead2/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -219,7 +219,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

47
Mumble/mumbleserver

@ -21,6 +21,7 @@ rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/murmur"
ini="murmur.ini"
backupdir="backups"
# Logging
logdir="${rootdir}/log"
@ -72,6 +73,52 @@ if [ ! -e ${filesdir}/${ini} ]; then
fi
}
fn_backupserver(){
fn_rootcheck
fn_syscheck
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo ""
echo "${gamename} Backup"
echo "============================"
echo ""
echo "The following backup will be created."
echo ""
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
read -p "Continue? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1 ;;
* ) echo "Please answer yes or no.";;
esac
done
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l)
if [ ${tmuxwc} -eq 1 ];then
echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running"
while true; do
read -p "Would you like to stop ${servicename} while running the backup? [y/N]" yn
case $yn in
[Yy]* ) fn_stopserver;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
echo -en "[ .... ] Starting ${servicename}: ${servername} backup"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} backup" >> ${scriptlog}
sleep 0.5
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername} backup"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} backup" >> ${scriptlog}
sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}
fn_distro(){
arch=$(uname -m)
kernel=$(uname -r)

6
NaturalSelection2/ns2server

@ -42,7 +42,7 @@ engine="spark"
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
backupdir="${rootdir}/backups"
backupdir="backups"
# Logging
logdays="7"
@ -223,7 +223,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}
@ -239,7 +239,7 @@ echo "Ports the server is currently using"
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/Rcon Port ${port}"
echo "INBOUND WebAdmin ${webadminport}"
echo "INBOUND WebAdmin ${webadminport}"
echo ""
echo "${servername} WebAdmin"
echo "======================="

4
NoMoreRoomInHell/nmrihserver

@ -38,7 +38,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/nmrih/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -223,7 +223,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
RedOrchestra/roserver

@ -24,8 +24,8 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/system"
backupdir="${rootdir}/backups"
compressedmapsdir="${rootdir}/Maps-Compressed"
backupdir="backups"
# Server Details
servicename="ro-server"
@ -285,7 +285,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
TeamFortress2/tf2server

@ -34,7 +34,7 @@ rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/tf/cfg/${servicename}.cfg"
backupdir="${rootdir}/backups"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -219,7 +219,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

7
TeamSpeak3/ts3server

@ -21,7 +21,7 @@ servicename="ts3-server"
rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
filesdir="${rootdir}/serverfiles"
ini="${servicename}.ini"
backupdir="${rootdir}/backups"
backupdir="backups"
# Logging
logdays="7"
@ -120,7 +120,6 @@ while true; do
* ) echo "Please answer yes or no.";;
esac
done
fn_status
if [ "$ts3status" = "Server is running" ]; then
echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running"
@ -142,7 +141,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}
@ -322,7 +321,7 @@ case "$1" in
backup)
fn_backupserver;;
monitor)
fn_monitorserver;;
fn_monitorserver;;
email-test)
fn_emailtest;;
*)

48
TheHiddenSource/thsserver

@ -31,6 +31,7 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
servercfg="${filesdir}/hidden/cfg/${servicename}.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g')
@ -174,6 +175,53 @@ else
fi
}
fn_backupserver(){
fn_rootcheck
fn_syscheck
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo ""
echo "${gamename} Backup"
echo "============================"
echo ""
echo "The following backup will be created."
echo ""
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
read -p "Continue? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1 ;;
* ) echo "Please answer yes or no.";;
esac
done
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l)
if [ ${tmuxwc} -eq 1 ];then
echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running"
while true; do
read -p "Would you like to stop ${servicename} while running the backup? [y/N]" yn
case $yn in
[Yy]* ) fn_stopserver;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
echo -en "[ .... ] Starting ${servicename}: ${servername} backup"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} backup" >> ${scriptlog}
sleep 0.5
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername} backup"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} backup" >> ${scriptlog}
sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}
fn_backupserver(){
fn_rootcheck
fn_syscheck

4
UnrealTournament2004/ut2k4server

@ -17,8 +17,8 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
backupdir="${rootdir}/backups"
compressedmapsdir="${rootdir}/Maps-Compressed"
backupdir="backups"
# Server Details
servicename="ut2k4-server"
@ -249,7 +249,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

4
UnrealTournament99/ut99server

@ -17,8 +17,8 @@ rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
backupdir="${rootdir}/backups"
compressedmapsdir="${rootdir}/Maps-Compressed"
backupdir="backups"
# Server Details
servicename="ut99-server"
@ -239,7 +239,7 @@ sleep 1
echo -en "\n"
cd ${rootdir}
mkdir ${backupdir} > /dev/null 2>&1
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} ${rootdir}
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude ${backupdir} *
echo -en "\r${servicename} backup complete"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog}
}

Loading…
Cancel
Save