]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
Fix some evil && and || use.
[backup.sh] / backup.sh
index ae4067859d755df691d2ac4747caadc871420a0e..848db267322a0d98cb763993d4bcc09c0191aa6f 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -213,21 +213,20 @@ do
  fi
 
  # Try to copy preeexec and postexec if they exist
-# TODO: Gah, clean this mess!
- [ -f $confdir/preexec.$computer ] && (
-    scp $confdir/preexec.$computer  root@$computer:~/.backup/preexec >&2 ||
-     ( echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec - skipping backup of $computer"
-       R=1
-       continue
-     )
-    )
- [ -f $confdir/postexec.$computer ] && (
-    scp $confdir/postexec.$computer root@$computer:~/.backup/postexec >&2 ||
-     ( echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec - skipping backup of $computer"
-       R=1
-       continue
-     )
-    )
+ if [ -f $confdir/preexec.$computer ]; then
+   if ! scp $confdir/preexec.$computer  root@$computer:~/.backup/preexec >&2; then
+     echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec - skipping backup of $computer"
+     R=1
+     continue
+   fi
+ fi
+ if [ -f $confdir/postexec.$computer ]; then
+   if ! scp $confdir/postexec.$computer root@$computer:~/.backup/postexec >&2; then
+     echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec - skipping backup of $computer"
+     R=1
+     continue
+   fi
+ fi
 
  # Try to run preexec if it exist
  if ! ssh root@$computer "[ ! -f ~/.backup/preexec ] || /bin/bash -x ~/.backup/preexec" >&2; then