Browse Source

Broadcasts to server that backup has started also broadcasts how long backup took

pull/890/head
zunnu 9 years ago
committed by GitHub
parent
commit
638a3f6360
  1. 8
      lgsm/functions/command_backup.sh

8
lgsm/functions/command_backup.sh

@ -10,6 +10,7 @@ local modulename="Backup"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh check.sh
command_execute.sh
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')" backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo "" echo ""
fn_print_info_nl "A total of $(du -sh "${rootdir}" --exclude="${backupdir}" | awk '{print $1}') will be compressed into the following backup:" fn_print_info_nl "A total of $(du -sh "${rootdir}" --exclude="${backupdir}" | awk '{print $1}') will be compressed into the following backup:"
@ -44,8 +45,13 @@ sleep 2
if [ ! -d "${backupdir}" ]; then if [ ! -d "${backupdir}" ]; then
mkdir "${backupdir}" mkdir "${backupdir}"
fi fi
begin=$(date +"%s")
execute "say Server backup started! PREPARE FOR LAG!"
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./* tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
termin=$(date +"%s")
difftimelps=$(($termin-$begin))
execute "say Backup complete it took $(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds!"
fn_print_ok_nl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size" fn_print_ok_nl "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" fn_scriptlog "Complete, Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
sleep 1 sleep 1
echo "" echo ""

Loading…
Cancel
Save