From: Steinar H. Gunderson Date: Sat, 4 Oct 2014 22:24:25 +0000 (+0200) Subject: Some minor cleanups. X-Git-Url: https://git.sesse.net/?p=backup.sh;a=commitdiff_plain;h=8250e4965bd8e356055c3b470a00df138d5edfbb Some minor cleanups. --- diff --git a/backup.sh b/backup.sh index e7c04c0..22f4e97 100755 --- a/backup.sh +++ b/backup.sh @@ -147,8 +147,6 @@ backup() # Something wrong happened. rm $TARFILE echo `date`" $computer: $TARFILE empty. $backuplevel backup of $computer:$filesystem failed and deleted" - - # We don't want to return 0 die fi @@ -172,8 +170,6 @@ backup() # Try to SSH to the computer without entering a password. if ! `ssh -n -o NumberOfPasswordPrompts=0 root@$computer /bin/true`; then echo `date`" $computer: Could not use passwordless SSH." - - # We don't want to return 0 die fi @@ -185,8 +181,6 @@ backup() compressor=gzip fi - filesystems="" - # Check dump bit in fstab filesystems=`ssh -n root@$computer "cat /etc/fstab" \ | grep -v nfs \ @@ -196,33 +190,33 @@ backup() # 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 - skipping backup of $computer" + echo `date`" $computer: Could not create backup staging area at $computer:~/.backup" die 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 - skipping backup of $computer" + echo `date`" $computer: Could not copy exclude.txt to $computer" die fi # Try to copy preeexec and postexec if they exist 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" + echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec" die 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" + echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec" die fi fi # Try to run preexec if it exist 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" + echo `date`" $computer: Could not run $computer:~/.backup/preexec" die fi @@ -248,8 +242,7 @@ backup() echo $DATEs > $storagedir/$computer/$sfilesystem/.date fi - # Check if we want a full backup - Debug statement that causes noise in cron mail: - # printf " $computer $filesystem: $confdir/fastfullbackupdag.$computer.$sfilesystem\n" + # Check if we want a full backup if [ -f $confdir/fastfullbackupdag.$computer.$sfilesystem ]; then fullbackup_min_for_this_machine=$dagermellomfulleforfast if [ "$DAY_OF_MONTH" = "`cat $confdir/fastfullbackupdag.$computer.$sfilesystem`" ]; then