From 3e4cf85d1ce5ff8ac0d9108c4da9ec89927c4905 Mon Sep 17 00:00:00 2001 From: micah Date: Fri, 2 Nov 2007 19:32:51 +0000 Subject: [PATCH] remove rsnap and rename rub handler to rsync, after consultation with rhatto git-svn-id: http://code.autistici.org/svn/backupninja/trunk@486 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 7 +- examples/Makefile.am | 2 +- examples/example.rsnap | 67 ---------- handlers/Makefile.am | 12 +- handlers/rsnap.in | 244 ---------------------------------- handlers/{rub.in => rsync.in} | 2 +- 6 files changed, 10 insertions(+), 324 deletions(-) delete mode 100644 examples/example.rsnap delete mode 100644 handlers/rsnap.in rename handlers/{rub.in => rsync.in} (99%) diff --git a/ChangeLog b/ChangeLog index 5aa1fd0..0dacc94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,11 +37,14 @@ version 0.9.5 -- unreleased . Handle "keep = yes" to disable old backups removal (Closes: #424633) . Add configuration option to allow you to disable the version check as in some instances this may be an ok scenario (Closes: #424632) - rub + rub/rsync . Fixed typo in rub handler that caused it to not work . Changed to use lib/vserver code . Fixed fsck error . Fixed integer comparison (Closes: Trac#3) + . Renamed handler to 'rsync', replaces outdated rub handler + . updated examples/Makefile.am and handlers/Makefile.am to include + rsnap/rsync (Closes: #440554) sys: . Fixed typo breaking things for VServers. . Fix bug when vrootdir is on its own partition (Closes: #395928) @@ -55,8 +58,6 @@ version 0.9.5 -- unreleased . Force C locale for sfdisk to ensure english words are found in grep fixed 'make install' bug that failed if /etc/backup.d already existed changed spaces to tabs in Makefile.am - updated examples/Makefile.am and handlers/Makefile.am to include rsnap/rub - files (Closes: #440554) version 0.9.4 -- October 6th, 2006 diff --git a/examples/Makefile.am b/examples/Makefile.am index ca8999f..5dfb7c3 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,6 @@ EXAMPLES = example.dup example.ldap example.makecd example.mysql \ - example.pgsql example.rdiff example.rsnap example.sh \ + example.pgsql example.rdiff example.sh \ example.svn example.sys example.trac EXTRA_DIST = $(EXAMPLES) diff --git a/examples/example.rsnap b/examples/example.rsnap deleted file mode 100644 index c1c50dd..0000000 --- a/examples/example.rsnap +++ /dev/null @@ -1,67 +0,0 @@ -## -## This is an example rsnap configuration file. -## The defaults are useful in most cases. -## - -## global options -[options] -options = - -## the nicelevel the backup and all the children should run at -## the higher nicelevel reduces the priority -nicelevel = 19 - -# how many days of data to keep -keep = 90 - -# the name of the directory created for the backup -label = systemname_domain_tld - -[source] - -# bandwidth limit to be used for rsync -bandwidthlimit = 1000 - -# remote_rsync can be used if your rsync is not in your PATH, or if you -# need a wrapper -#remote_rsync = /usr/local/bin/sudo_rsync - -# options like -P can be specified here -#sshoptions = - -# test the ssh connection before proceding? -testconnect = yes - -# don't translate owner+groupid's to local names -numericids = 1 - -# turn on rsync compression? (1 = on, 0 = off) -compress = 1 - -srchost = backupuser@hostname.domain.tld - -# files to include in the backup -# (supports globbing with '*'), by default / is included -include = /var -include = /usr/local -include = /home - -# files to exclude from the backup -# (supports globbing with '*') -exclude = /home/*/Maildir -exclude = /var/log -exclude = /proc -exclude = /srv -exclude = /sys -exclude = /*.gz - -[dest] - -# base directory where backup is made to -directory = /media/backup - -# only necessary if you hit a specifi 2.4 kernel bug -enable_mv_timestamp_bug = no - -# if you say no here, only one dir is kept, and 'keep' is irrelevant -incremental = yes 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 similarity index 99% rename from handlers/rub.in rename to 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 -- 2.30.2