From: Matthijs Kooijman Date: Fri, 19 Mar 2010 20:31:46 +0000 (+0100) Subject: tar: Support running on multiple backends. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;ds=inline;p=matthijs%2Fupstream%2Fbackupninja.git tar: Support running on multiple backends. --- diff --git a/handlers/tar.in b/handlers/tar.in index f75df22..da8125f 100644 --- a/handlers/tar.in +++ b/handlers/tar.in @@ -3,8 +3,6 @@ # # tar handler script for backupninja -getconf backupname `hostname --fqdn` -getconf backupdir /var/backups/`hostname --fqdn` getconf compress bzip getconf includes "/etc /home /usr/local" getconf excludes "/tmp /proc /dev /sys /net /misc /media /srv /selinux" @@ -21,6 +19,11 @@ then fi function make_backup () { + getconf backupdir /var/backups/`hostname --fqdn` + backupdir=`interpolate "$backupdir"` + getconf backupname `hostname --fqdn` + backupname=`interpolate "$backupname"` + if [ ! -d "$backupdir" ] then mkdir -p "$backupdir" || fatal "Can not make directory $backupdir" @@ -62,16 +65,22 @@ function make_backup () { exclude_options="" for i in $excludes do - exclude_options="$exclude_options --exclude $i" + exclude_options="$exclude_options --exclude $root$i" + done + + include_options="" + for i in $includes + do + include_options="$include_options $root$i" done debug "Running backup: " $TAR -c -p -v $compress_option $exclude_options \ -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ - $includes + $include_options $TAR -c -p -v $compress_option $exclude_options \ -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ - $includes \ + $include_options \ > "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.list \ 2> "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.err @@ -79,4 +88,5 @@ function make_backup () { } -make_backup +init_source_hosts +run_for_source_hosts make_backup