From d5fab66d097c6b9db8b54ad0a70ee0b63b4989df Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 5 Oct 2014 19:59:45 +0200 Subject: [PATCH] Slightly more consistent names for the .snar files. --- backup.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/backup.sh b/backup.sh index 961c0c2..c1c4439 100755 --- a/backup.sh +++ b/backup.sh @@ -78,24 +78,27 @@ backup() { infomsg "$computer:$filesystem $backuplevel backup\n" - SNARFILE="${storagedir}/${computer}/${sfilesystem}/.incremental.snar" - incrementalsnar="/root/.backup/${sfilesystem}.snar" + localsnar="${storagedir}/${computer}/${sfilesystem}/.incremental.snar" + remotesnar="/root/.backup/${sfilesystem}.snar" if [ "$backuplevel" = "daglig" ]; then # If incremental backup, we need to copy the incremental status to $computer. # If it does not exist, whine a bit and then run date-based instead. - if [ -s "$SNARFILE" ]; then - if ! scp $SNARFILE root@$computer:$incrementalsnar; then + if [ -s "$localsnar" ]; then + if ! scp $localsnar root@$computer:$remotesnar; then diemsg "Could not copy .incremental.snar to $computer" fi - lastcmd="--listed-incremental=$incrementalsnar --no-check-device" + lastcmd="--listed-incremental=$remotesnar --no-check-device" else infomsg "Missing incremental.snar for $filesystem, doing date-based backup instead until next full backup" - incrementalsnar="" + remotesnar="" lastd=`cat ../.date` lastcmd="--newer='$lastd'" fi else - lastcmd="--listed-incremental=$incrementalsnar" + # Note: Since we rm-ed .backup previously, and we don't scp over + # anything in this branch, this file will not exist, and we + # will be doing a full backup (but we want the output of it). + lastcmd="--listed-incremental=$remotesnar" fi # We try to run tar on the remote computer @@ -117,16 +120,16 @@ backup() if [ $? -eq 0 ] && [ -s $TARFILE ]; then # File is >0 in size and neither cat or tar tzvf failed; we assume it worked. - if [ "$incrementalsnar" ]; then - if ! scp root@$computer:$incrementalsnar $SNARFILE.tmp; then + if [ "$remotesnar" ]; then + if ! scp root@$computer:$remotesnar $localsnar.tmp; then diemsg "Could not copy .incremental.snar from $computer" fi fi # Move tar file in place mv $TARFILE $DATE.tgz - if [ "$incrementalsnar" ]; then - mv $SNARFILE.tmp $SNARFILE + if [ "$remotesnar" ]; then + mv $localsnar.tmp $localsnar fi # Update timestamp -- 2.39.2