From 638a3f63602009aa37da840c65433eb7aedc1209 Mon Sep 17 00:00:00 2001 From: zunnu Date: Sun, 19 Jun 2016 23:49:58 +0300 Subject: [PATCH] Broadcasts to server that backup has started also broadcasts how long backup took --- lgsm/functions/command_backup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh index f5c517129..8e09fdf3e 100644 --- a/lgsm/functions/command_backup.sh +++ b/lgsm/functions/command_backup.sh @@ -10,6 +10,7 @@ local modulename="Backup" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh +command_execute.sh backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')" echo "" 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 mkdir "${backupdir}" fi +begin=$(date +"%s") +execute "say Server backup started! PREPARE FOR LAG!" 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_scriptlog "Complete, Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size" sleep 1 -echo "" \ No newline at end of file +echo ""