]> git.sesse.net Git - backup.sh/commitdiff
Slightly more consistent names for the .snar files.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 5 Oct 2014 17:59:45 +0000 (19:59 +0200)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 5 Oct 2014 17:59:45 +0000 (19:59 +0200)
backup.sh

index 961c0c2ea88c7ae391a3a3d1e8936576ca9ecd9b..c1c4439c44e73d9500cc175b14b959338c777712 100755 (executable)
--- 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