Browse Source

Fixed backing up folders + size info & appearance

pull/767/head
UltimateByte 9 years ago
parent
commit
ee71fe5fad
  1. 33
      functions/command_backup.sh

33
functions/command_backup.sh

@ -2,7 +2,7 @@
# LGSM command_backup.sh function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
lgsm_version="271215"
lgsm_version="180316"
# Description: Creates a .tar.gz file in the backup directory.
@ -12,11 +12,7 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo ""
echo "${gamename} Backup"
echo "============================"
echo ""
echo "The following backup will be created:"
echo ""
fn_printinfonl "A total of $(du -sh "${rootdir}" --exclude="${backupdir}" | awk '{print $1}') will be compressed into the following backup:"
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
@ -27,6 +23,7 @@ while true; do
* ) echo "Please answer yes or no.";;
esac
done
echo ""
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
if [ "${tmuxwc}" -eq 1 ]; then
echo ""
@ -41,24 +38,14 @@ if [ "${tmuxwc}" -eq 1 ]; then
esac
done
fi
fn_scriptlog "Started"
echo -en "starting backup.\r"
sleep 1
echo -en "starting backup..\r"
sleep 1
echo -en "starting backup...\r"
sleep 1
echo -en "\n"
cd "${rootdir}"
fn_scriptlog "Started backup"
fn_printdots "Starting backup, please wait..."
sleep 2
if [ ! -d "${backupdir}" ]; then
mkdir -v "${backupdir}"
mkdir "${backupdir}"
fi
tar -cvzf "${backupdir}/${backupname}.tar.gz" --exclude "${backupdir}" ./*
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
echo ""
echo "Backup created: ${backupdir}/${backupname}.tar.gz"
fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz"
fn_printoknl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
fn_scriptlog "Complete, Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
sleep 1
echo ""
fn_printcompletenl "Complete."
fn_scriptlog "Complete"
echo ""

Loading…
Cancel
Save