]> git.sesse.net Git - backup.sh/commitdiff
Correct logic on evaluating and running {pre,post}exec
authorroot <empty>
Tue, 31 Jul 2007 20:41:24 +0000 (20:41 +0000)
committerroot <empty>
Tue, 31 Jul 2007 20:41:24 +0000 (20:41 +0000)
backup.sh

index ee6e98b8ed3a5996cd611adcbb1a82b860efc64b..2838aae5d9bd73a0faf14c74af983fe022e1079c 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -184,14 +184,14 @@ do
  #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 ||
+    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 ||
+    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
@@ -199,7 +199,7 @@ do
     )
 
  #try to run preexec if it exist
- if ! ssh root@$computer "[ -f ~/.backup/preexec ] && /bin/bash -x ~/.backup/preexec" >&2; then
+ if ! ssh root@$computer "[ ! -f ~/.backup/preexec ] || /bin/bash -x ~/.backup/preexec" >&2; then
        echo `date`" $computer: Could not run $computer:~/.backup/preexec - skipping backup of $computer"
        R=1
        continue
@@ -264,7 +264,7 @@ do
  done
 
  #try to run postexec if it exist
- if ! ssh root@$computer "[ -f ~/.backup/postexec ] && /bin/bash -x ~/.backup/postexec" >&2; then
+ if ! ssh root@$computer "[ ! -f ~/.backup/postexec ] || /bin/bash -x ~/.backup/postexec" >&2; then
        echo `date`" $computer: Could not run $computer:~/.backup/postexec"
        R=1
  fi