Browse Source

added tar error checking

pull/914/head
Daniel Gibbs 9 years ago
parent
commit
da4abb8975
  1. 12
      lgsm/functions/command_backup.sh

12
lgsm/functions/command_backup.sh

@ -17,7 +17,7 @@ fn_print_info_nl "A total of ${rootdirduexbackup} will be compressed into the fo
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
read -e -i "y" -p "Continue? [Y/N]" yn
read -p "Continue? [Y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return;;
@ -47,9 +47,13 @@ if [ ! -d "${backupdir}" ]; then
mkdir "${backupdir}"
fi
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
# NOTE: Need to add error checking for tar.
fn_print_ok_nl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
fn_script_log_pass "Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
if [ $? != 0 ]; then
fn_print_ok_nl "Backup created: ${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
fn_script_log_pass "Backup created: ${backupdir}/${backupname}.tar.gz is $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}') size"
else
fn_print_error_nl "Backup failed: ${backupname}.tar.gz"
fn_script_log_error "Backup failed: ${backupname}.tar.gz"
fi
sleep 1
echo ""
core_exit.sh
Loading…
Cancel
Save