rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[rdiff-backup-users] Re: New rdiff-backup wiki!


From: Troels Arvin
Subject: [rdiff-backup-users] Re: New rdiff-backup wiki!
Date: Thu, 30 Oct 2003 14:28:05 +0100
User-agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)

On Thu, 30 Oct 2003 23:01:38 +1100, David Kempe wrote:

> I added a Contributed scripts section in case anyone found my pitiful
> firewire backup script useful :)

And I added a script which I use in different places. However, I have
somehow broken the wiki by doing that -
http://rdiff-backup.solutionsfirst.com.au/index.php?ContribScripts
currently says "WikiFatalError - Stack bounds exceeded in
SetHTMLOutputMode". Sorry about that.

> I like Wikis.

I do, too. But I don't understand them...

The script I wanted to add:

#!/bin/sh

# This script should be run on the backup-server, i.e. the 
# server storing the backup-data.
# It's assumed that ssh will be used to transport the 
# data, and that unattended ssh-login has been set up,
# see http://arctic.org/~dean/rdiff-backup/unattended.html

# The script may be put in a crontab so that backup is
# done every night.

# Version 1.0 (Thu Oct 30 2003) by Troels Arvin <address@hidden>.
# Use at your own risk.

# Room for improvement:
#  - backup the remote hosts in parallel
#  - use lock-files/semaphores to prevent concurrent
#    backup of the same host
#  - different options for the different hosts

########################################################
# Configuration                                        #
########################################################

# The remote hosts that need to be backed up to this host
BACKUP_HOSTS='host1.mydomain.com host2.mydomain.com host3.mydomain.com'

# Where to store the backup data
BACKUP_DIR="/home/backup"

# What area to backup and not to backup on the remote hosts
BACKUP_PATH="/"
EXCLUDES="/tmp /var/tmp /var/log /proc /mnt/cdrom"
EXCLUDE_OPTIONS="--exclude-device-files"

# What user to login as on the remote hosts
SSH_USER='root'

# How long to keep changes. 1M = 1 month
MAXAGE="1M"

# Which program to invoke
BINARY=/usr/bin/rdiff-backup

# Some basic configuration options; see the manual
OTHER_OPTIONS="--print-statistics --no-change-dir-inc-perms"


########################################################
# Perform backup                                       #
########################################################

# Build a bunch of --exclude ... statements and construct
# a number of arguments to send to rdiff-backup.
for i in $EXCLUDES; do
   EXCLUDE_OPTIONS="$EXCLUDE_OPTIONS --exclude $i"
done
OPTIONS="$EXCLUDE_OPTIONS $OTHER_OPTIONS"

# Go through each remote host.
for BACKUP_HOST in $BACKUP_HOSTS; do
   SRC="address@hidden::${BACKUP_PATH}"
   DST="$BACKUP_DIR/${BACKUP_HOST}${BACKUP_PATH}"

   # Make sure there is a valid place to put the data
   if [ -e "$DST" ]; then
      if [ ! -d "$DST" ]; then
         echo "Strange: '$DST' exists, but is not a directory"
         exit 1
      fi
   else
      mkdir -p $DST
      echo "created $DST"
   fi

   # Backup
   echo "Doing this: $BINARY $OPTIONS $SRC $DST"
   echo "Backing up $BACKUP_HOST"
   $BINARY $OPTIONS $SRC $DST

   # How did it go?
   if [ $? -eq 0 ]; then
      # It went well; removing stuff older than MAXAGE
      $BINARY --force --remove-older-than $MAXAGE $DST
      if [ $? -eq 0 ]; then
         echo "Clean-up OK"
      else
         echo "running this failed (during clean-up):"
         echo "$BINARY --force remove-older-than $MAXAGE $DST"
      fi
   else
      # It failed; don't clean up. Assume that the
      # cron system mails output to a relevant
      # recipient.
      echo "running this failed:"
      echo "$BINARY $OPTIONS $SRC $DST"
   fi
done






reply via email to

[Prev in Thread] Current Thread [Next in Thread]