]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
When we run out of disk, do not count that as success.
[backup.sh] / backup.sh
index 1f7031ee3937051eb448bd1deeae68414e3e3211..652b4636b36b8406a2631b0f2c5f5d234b0a0232 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
 # 
 # The script is halfway Norwegian and halfway English. Newer modifications are
 # in English, we should probably stick to that.
-# 
-# Known issues:
-#
-# o $R has no proper meaning because of the forking subshell stuff. We need a
-#   more robust way of returning non-zero on errors, which we probably don't
-#   right now.
-#
 
 # The computer to backup.
 computer=$1
@@ -111,8 +104,8 @@ backup()
  echo `date`" $computer: Running $TARCMD" >&2
  eval $TARCMD > $DATE.idx
 
- if [ -s $TARFILE ]; then
-  # File is >0 in size, we assume it worked.
+ if [ $? -eq 0 ] && [ -s $TARFILE ]; then
+  # File is >0 in size and neither cat or tar tzvf failed; we assume it worked.
 
   # Move tar file in place
   mv $TARFILE $DATE.tgz
@@ -143,6 +136,10 @@ backup()
 
  # Check that the target filesystem is mounted (actually check that it's not
  # the root filesystem)
+ if [ ! -d "$storagedir/$computer" ]; then
+       echo `date`" $computer: Target filesystem ($storagedir/$computer) does not exist. Aborting"
+       die
+ fi
  rootfilesystem=`df -P /`
  targetfilesystem=`df -P "$storagedir/$computer"`
  if [ "$rootfilesystem" == "$targetfilesystem" ]; then