aboutsummaryrefslogtreecommitdiff
path: root/templates/rsync-check.sh.erb
blob: 879faaf59baee3da996f10659e59bbe2efccb683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Check rsync backup sets.
#

BACKUP_FOLDER="<%= backupdir_remote %>"

if [ -e "$BACKUP_FOLDER" ]; then
  cwd="`pwd`"
  cd $BACKUP_FOLDER
  
  for set in `find -maxdepth 2 -name 'rsync'`; do
    echo " "
    echo "Checking backup set $set..."
    echo "======================================================"
    echo " "

    # Check rsync metadata
    for metadata in `find $set -name created`; do
      echo $metadata
      cat  $metadata
    done

    # Check duplicity metadata
    if [ -d "$set/<%= backupdir %>/duplicity" ]; then
      for duplicity in `ls -1 $set/<%= backupdir %>/duplicity | grep -v metadata | xargs`; do
        echo " "
        echo "Checking duplicity backup found at $set/<%= backupdir %>/duplicity/$duplicity..."
        echo "======================================================"
        echo " "
        duplicity collection-status file:///$BACKUP_FOLDER/$set/<%= backupdir %>/duplicity/$duplicity
      done
    fi
  done
  
  cd $cwd
fi