From d23558ab4ddf2c543a2051c3e868d158e0e1ed2b Mon Sep 17 00:00:00 2001 From: root Date: Sun, 29 Jul 2007 14:14:00 +0000 Subject: [PATCH] =?utf8?q?Warn=20on=20{pre,=C3post}exec=20failures?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- backup.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/backup.sh b/backup.sh index 956d3b0..33f4bb3 100755 --- a/backup.sh +++ b/backup.sh @@ -167,39 +167,44 @@ do #clean up our dir at this client if ! ssh root@$computer "rm -r ~/.backup ; mkdir -m 700 ~/.backup"; then - echo `date`" $computer: Could not create backup staging area at $computer:~/.backup" + echo `date`" $computer: Could not create backup staging area at $computer:~/.backup - skipping backup of $computer" # We don't want to return 0 R=1 - break; + continue; fi #try to copy $exclude to $computer if ! scp $exclude root@$computer:~/.backup/exclude > /dev/null; then - echo `date`" $computer: Could not copy exclude.txt to $computer" + echo `date`" $computer: Could not copy exclude.txt to $computer - skipping backup of $computer" # We don't want to return 0 R=1 - break; + continue; 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 || - ( echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec"; + ( echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec - skipping backup of $computer" R=1 - break + continue ) ) [ -f $confdir/postexec.$computer ] && ( scp $confdir/postexec.$computer root@$computer:~/.backup/postexec || - ( echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec" - break + ( echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec - skipping backup of $computer" R=1 + continue ) ) #try to run preexec if it exist - ssh root@$computer "[ -f ~/.backup/preexec ] && /bin/bash -x ~/.backup/preexec" + 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 + fi + for filesystem in $filesystems do @@ -259,7 +264,10 @@ do done #try to run postexec if it exist - ssh root@$computer "[ -f ~/.backup/postexec ] && /bin/bash -x ~/.backup/postexec" + 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 ) done & -- 2.39.2