From 7f9aae3c11b0bb3c7ef9d39c5c46aeff635994c4 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 19 Mar 2010 21:31:46 +0100 Subject: [PATCH] tar: Support running on multiple backends. --- handlers/tar.in | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) 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 -- 2.30.2