aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2007-11-02 19:32:51 +0000
committerMicah Anderson <micah@riseup.net>2007-11-02 19:32:51 +0000
commit3a74d7d526b38b232b839c4e4b0bc1420ae664f8 (patch)
tree02daec51b6b5bed8bb546dece1f318a1c66e66a2 /handlers
parent3cf6de437495495ea400ade55f7b13d4077b8cb3 (diff)
downloadbackupninja-3a74d7d526b38b232b839c4e4b0bc1420ae664f8.tar.gz
backupninja-3a74d7d526b38b232b839c4e4b0bc1420ae664f8.tar.bz2
remove rsnap and rename rub handler to rsync, after consultation with rhatto
Diffstat (limited to 'handlers')
-rw-r--r--handlers/Makefile.am12
-rw-r--r--handlers/rsnap.in244
-rw-r--r--handlers/rsync.in (renamed from handlers/rub.in)2
3 files changed, 5 insertions, 253 deletions
diff --git a/handlers/Makefile.am b/handlers/Makefile.am
index 710b25e..be8c7b5 100644
--- a/handlers/Makefile.am
+++ b/handlers/Makefile.am
@@ -1,7 +1,7 @@
HANDLERS = dup dup.helper ldap ldap.helper maildir makecd \
makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff \
- rdiff.helper rsnap rub sh svn sys sys.helper trac
+ rdiff.helper rsync sh svn sys sys.helper trac
CLEANFILES = $(HANDLERS)
@@ -66,13 +66,9 @@ rdiff.helper: $(srcdir)/rdiff.helper.in
rm -f rdiff.helper
$(edit) $(srcdir)/rdiff.helper.in > rdiff.helper
-rsnap: $(srcdir)/rsnap.in
- rm -f rsnap
- $(edit) $(srcdir)/rsnap.in > rsnap
-
-rub: $(srcdir)/rub.in
- rm -f rub
- $(edit) $(srcdir)/rub.in > rub
+rsync: $(srcdir)/rsyn.in
+ rm -f rsync
+ $(edit) $(srcdir)/rsync.in > rsync
sh: $(srcdir)/sh.in
rm -f sh
diff --git a/handlers/rsnap.in b/handlers/rsnap.in
deleted file mode 100644
index 017a456..0000000
--- a/handlers/rsnap.in
+++ /dev/null
@@ -1,244 +0,0 @@
-# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
-#
-# rsync backup handler for backupninja
-# requires rsync and optional freedups
-#
-# freedups:
-# http://www.stearns.org/freedups/
-# http://freshmeat.net/projects/freedups/
-#
-# rsync:
-# http://samba.anu.edu.au/rsync/
-
-# exit on error
-#set -e
-
-# System commands used by this script
-# replace with absolute path's if neccecary
-getconf rm rm
-getconf cp cp
-getconf touch touch
-getconf mv mv
-getconf ssh ssh
-getconf tr tr
-getconf rsync $RSYNC
-
-setsection options
-getconf options
-getconf label
-getconf nicelevel 0
-getconf keep 60
-
-setsection source
-getconf testconnect no
-getconf srchost localhost
-getconf compress 1
-getconf sshoptions
-getconf bandwidthlimit 1000
-getconf remote_rsync rsync
-getconf numericids 1
-getconf include
-getconf vsnames all
-getconf vsinclude
-getconf include
-getconf exclude
-
-setsection dest
-getconf directory
-getconf enable_mv_timestamp_bug no
-getconf freedups freedups
-getconf enable_freedups no
-getconf incremental yes
-
-# Apparently, a bug in some Linux kernels between 2.4.4 and 2.4.9 causes mv to update timestamps;
-# this may result in inaccurate timestamps on the snapshot directories.
-# Set enable_mv_timestamp_bug=1 to enable this workaround
-if [ $enable_mv_timestamp_bug == "yes" ]; then
- mv=my_mv
-fi;
-
-function my_mv() {
- ref=/tmp/makesnapshot-mymv-$$;
- $touch -r $1 $ref;
- $mv $1 $2;
- $touch -r $ref $2;
- $rm $ref;
-}
-
-if [ $enable_freedups == "yes" ]; then
- # $freedups
- debug "Not implemented yet!"
-fi;
-
-
-[ "$directory" != "" ] || fatal "Destination directory not set"
-[ "$include" != "" ] || fatal "No source includes specified"
-
-### vservers stuff ###
-
-# If vservers are configured, check that the ones listed in $vsnames do exist.
-local usevserver=no
-if [ $vservers_are_available = yes ]; then
- if [ "$vsnames" = all ]; then
- vsnames="$found_vservers"
- else
- if ! vservers_exist "$vsnames" ; then
- fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
- fi
- fi
- if [ -n "$vsinclude" ]; then
- info "Using vservers '$vsnames'"
- usevserver=yes
- fi
-else
- [ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
- [ -z "$vsnames" ] || warning 'vservers support disabled in backupninja.conf, vsnames configuration line will be ignored'
-fi
-
-### see if we can login ###
-
-if [ "$testconnect" == "yes" ]; then
- debug "$ssh $sshoptions -o PasswordAuthentication=no $srchost 'echo -n 1'"
- if [ ! $test ]; then
- result=`ssh $sshoptions -o PasswordAuthentication=no $srchost 'echo -n 1'`
- if [ "$result" != "1" ]; then
- fatal "Can't connect to $srchost."
- else
- debug "Connected to $srchost successfully"
- fi
- fi
-fi
-
-### COMMAND-LINE MANGLING ###
-
-[ "$bandwidthlimit" == 1000 ] || options="$options --bwlimit=$bandwidthlimit"
-[ "$numericids" == 1 ] || options="$options --numeric-ids "
-[ "$compress" == 1 ] || options="$options --compress "
-[ "$remote_rsync" == "rsync" ] || options="$options --rsync-path=$remote_rsync"
-
-if [ "$nicelevel" -ne 0 ]; then
- nice="nice -n $nicelevel" ;
-else
- nice="";
-fi
-
-execstr="$options --exclude '/' --delete-during --delete-excluded --archive $sshoptions "
-
-if [ "$incremental" == "no" ]; then
- execstr="${execstr} --whole-file "
-fi
-
-execstr_serverpart="$srchost:/"
-
-
-### SOURCE ###
-
-set -o noglob
-
-# excludes
-for i in $exclude; do
- str="${i//__star__/*}"
- #execstr="${execstr}--exclude '$str' "
- execstr="${execstr}--exclude $str "
-done
-
-# includes
-for i in $include; do
- str="${i//__star__/*}"
- #execstr="${execstr}--include '$str' "
- execstr="${execstr}--include $str "
-done
-
-# vsincludes
-if [ $usevserver = yes ]; then
- for vserver in $vsnames; do
- for vi in $vsinclude; do
- str="${vi//__star__/*}"
- execstr="${execstr}--include '$label/$vserver$str' "
- done
- done
-fi
-
-
-### SNAPSHOT ROTATION ###
-
-if [ "$incremental" == "yes" ]; then
- debug "starting to rotate the old dirs"
- # rotating snapshots
- # delete the oldest snapshot, if it exists:
- debug "does $directory/$label/$keep exist?"
- if [ -d "$directory/$label/$keep" ] ; then
- debug "$rm -rf $directory/$label/$keep"
- if [ !$test ]; then
- #$rm -rf "$directory/$label/$keep" ;
- debug "$rm -rf $directory/$label/$keep";
- fi;
- fi;
-
- # shift the snapshots(s) back by one, if they exist
- for (( i=$keep; $i>=0; i--)) ; do
- debug "does $directory/$label/$i exist?"
- if [ -d "$directory/$label/$i" ] ; then
- debug "$mv $directory/$label/$i $directory/$label/$(($i + 1))"
- if [ !$test ]; then
- $mv "$directory/$label/$i" "$directory/$label/$(($i + 1))"
- fi;
- fi;
- done
-
- # make a hard-link-only (except for dirs) copy of
- # assuming that exists, into the new dir
- if [ -d "$directory/$label/1" ]; then
- debug "$cp -al $directory/$label/1 $directory/$label/0"
- if [ !$test ]; then
- $cp -al $directory/$label/1 $directory/$label/0 ;
- fi;
- fi;
-
-fi
-
-
-set +o noglob
-
-### EXECUTE ###
-
-# exclude everything else, start with root
-#execstr="${execstr}--exclude '*' "
-
-# include client-part and server-part
-#execstr="$execstr $execstr_serverpart"
-
-execstr=${execstr//\\*/\\\\\\*}
-
-if [ "$debug" == "1" ]; then
- execstr=" --verbose $execstr";
- # execstr=" --verbose --dry-run $execstr";
-else
- execstr=" --quiet $execstr";
-fi;
-
-debug "$rsync $execstr $execstr_serverpart $directory/$label/0"
-
-
-# rsync from the system into the latest snapshot (notice that
-# rsync behaves like cp --remove-destination by default, so the destination
-# is unlinked first. If it were not so, this would copy over the other
-# snapshot(s) too!
-output=`$nice $rsync $execstr $execstr_serverpart $directory/$label/0 2>&1`
-code=$?
-
-# update the mtime of the 0 dir to reflect the snapshot time
-$touch $directory/$label/0
-
-if [ $code -eq 0 ]; then
- debug $output
- info "rsync finished successfully.";
-else
- debug "returncode $code : $output "
- #fatal "rsync failed.";
- warning "rsync failed.";
-fi;
-
-
-return 0;
-
diff --git a/handlers/rub.in b/handlers/rsync.in
index bdd6e99..d3d704c 100644
--- a/handlers/rub.in
+++ b/handlers/rsync.in
@@ -63,7 +63,7 @@ getconf mv mv
getconf fsck fsck
setsection general
-getconf log /var/log/backupninja-rub.log
+getconf log /var/log/backupninja-rsync.log
getconf partition
getconf fscheck
getconf read_only