From a03dd20298240ff11febd4bfd747a70e098ae67b Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 23 Mar 2007 00:09:41 +0000 Subject: [PATCH 01/16] commented out info line git-svn-id: http://code.autistici.org/svn/backupninja/trunk@470 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/maildir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/maildir b/handlers/maildir index ab89f70..ece5702 100644 --- a/handlers/maildir +++ b/handlers/maildir @@ -335,7 +335,7 @@ if [ "$backup" == "yes" ]; then debug $i for user in `ls -1`; do [ "$user" != "" ] || continue - info $user + #info $user do_rotate $user setup_remote_dirs $user $btype do_user $user $btype -- 2.30.2 From 7d72093e3ea3449a7bc8392057ebe3bd18d1c3ee Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 23 Apr 2007 00:10:50 +0000 Subject: [PATCH 02/16] made maildir handler spit out username when in debug mode git-svn-id: http://code.autistici.org/svn/backupninja/trunk@471 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/maildir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/maildir b/handlers/maildir index ece5702..4b98deb 100644 --- a/handlers/maildir +++ b/handlers/maildir @@ -335,7 +335,7 @@ if [ "$backup" == "yes" ]; then debug $i for user in `ls -1`; do [ "$user" != "" ] || continue - #info $user + debug $user do_rotate $user setup_remote_dirs $user $btype do_user $user $btype -- 2.30.2 From 645cb19f7bf5e9866b4171ef4a0cd83048a8f8c1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 19 Jun 2007 09:55:13 +0000 Subject: [PATCH 03/16] rdiff: handle "keep = yes" to disable old backups removal (Closes: #424633) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@472 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + examples/example.rdiff | 2 ++ handlers/rdiff | 40 ++++++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1179b03..6ad819e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ version 0.9.5 -- unreleased (Closes: #396578) rdiff: . Added cstream support to allow for bandwidth limiting + . Handle "keep = yes" to disable old backups removal (Closes: #424633) rub . Fixed typo in rub handler that caused it to not work . Changed to use lib/vserver code diff --git a/examples/example.rdiff b/examples/example.rdiff index 5ad700b..c327fd6 100644 --- a/examples/example.rdiff +++ b/examples/example.rdiff @@ -38,6 +38,8 @@ type = local # how many days of data to keep # (you can also use the time format of rdiff-backup, e.g. 6D5h) +# (to keep everything, set this to yes) +#keep = yes keep = 60 # A few notes about includes and excludes: diff --git a/handlers/rdiff b/handlers/rdiff index 5561435..52637cd 100644 --- a/handlers/rdiff +++ b/handlers/rdiff @@ -152,27 +152,31 @@ esac ### REMOVE OLD BACKUPS ### -if [ "`echo $keep | tr -d 0-9`" == "" ]; then +if [ "$keep" != yes ]; then + + if [ "`echo $keep | tr -d 0-9`" == "" ]; then # add D if no other date unit is specified - keep="${keep}D" -fi + keep="${keep}D" + fi -removestr="$RDIFFBACKUP $options --force --remove-older-than $keep " -if [ "$desttype" == "remote" ]; then - removestr="${removestr}${destuser}@${desthost}::" -fi -removestr="${removestr}${destdir}/${label}"; + removestr="$RDIFFBACKUP $options --force --remove-older-than $keep " + if [ "$desttype" == "remote" ]; then + removestr="${removestr}${destuser}@${desthost}::" + fi + removestr="${removestr}${destdir}/${label}"; + + debug "$removestr" + if [ $test = 0 ]; then + output="`su -c "$removestr" 2>&1`" + if [ $? = 0 ]; then + debug $output + info "Removing backups older than $keep days succeeded." + else + warning $output + warning "Failed removing backups older than $keep." + fi + fi -debug "$removestr" -if [ $test = 0 ]; then - output="`su -c "$removestr" 2>&1`" - if [ $? = 0 ]; then - debug $output - info "Removing backups older than $keep days succeeded." - else - warning $output - warning "Failed removing backups older than $keep." - fi fi # Add cstream -- 2.30.2 From fc183f265fb71bde510790e7d19a59df6f38d74d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 19 Jun 2007 10:00:30 +0000 Subject: [PATCH 04/16] rub: Fixed integer comparison (Closes: Trac#3) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@473 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + handlers/rub | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6ad819e..1bcac30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ version 0.9.5 -- unreleased . 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) sys: . Fixed typo breaking things for VServers. . Fix bug when vrootdir is on its own partition (Closes: #395928) diff --git a/handlers/rub b/handlers/rub index e05b6fd..bdd6e99 100644 --- a/handlers/rub +++ b/handlers/rub @@ -100,7 +100,7 @@ getconf service function rotate { - if [[ "$2" < 4 ]]; then + if [[ "$2" -lt 4 ]]; then error "Rotate: minimum of 4 rotations" exit 1 fi -- 2.30.2 From a4bb8778ed109091911ae8e310cd8b93c97e3115 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 19 Jun 2007 20:53:23 +0000 Subject: [PATCH 05/16] added Trac tickets report URL to TODO git-svn-id: http://code.autistici.org/svn/backupninja/trunk@474 758a04ac-41e6-0310-8a23-8373a73cc35d --- TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO b/TODO index 04503b1..16ee78c 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,9 @@ you are working on it! . Fix all bugs reported on the Debian BTS: http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=backupninja&archive=no +. Fix all bugs reported on our Trac: + https://code.autistici.org/trac/backupninja/report/3 + . Make ninjahelper allow you to pick what type of backup you want (instead of just assuming you want local-to-remote, or push backups. Some people want local-to-local, or remote-to-local, or pull backups). This has been -- 2.30.2 From 244116f98b923dd7942ada170c4130ee7cb7332a Mon Sep 17 00:00:00 2001 From: micah Date: Sat, 28 Jul 2007 11:36:40 +0000 Subject: [PATCH 06/16] add patch to ignore rdiff minor version levels git-svn-id: http://code.autistici.org/svn/backupninja/trunk@475 758a04ac-41e6-0310-8a23-8373a73cc35d --- AUTHORS | 3 ++- ChangeLog | 1 + handlers/rdiff | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index fad2bbb..541e949 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,4 +21,5 @@ garcondumonde@riseup.net Martin Krafft madduck@debian.org -- admingroup patch Anarcat -- lotsa patches Jamie McClelland -- cstream patches -ale -- ldap cleanup \ No newline at end of file +ale -- ldap cleanup +Sami Haahtinen \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 1bcac30..50e4760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ version 0.9.5 -- unreleased rdiff: . Added cstream support to allow for bandwidth limiting . Handle "keep = yes" to disable old backups removal (Closes: #424633) + . Ignore rdiff-backup minor versions (thanks Sami Haahtinen) rub . Fixed typo in rub handler that caused it to not work . Changed to use lib/vserver code diff --git a/handlers/rdiff b/handlers/rdiff index 52637cd..46cae49 100644 --- a/handlers/rdiff +++ b/handlers/rdiff @@ -32,12 +32,12 @@ function get_version() { # if user or host is missing, returns the local version. if [ "$#" -lt 2 ]; then debug "$RDIFFBACKUP -V" - echo `$RDIFFBACKUP -V` + echo `$RDIFFBACKUP -V | cut -d. -f1,2` else local user=$1 local host=$2 debug "ssh $sshoptions $host -l $user '$RDIFFBACKUP -V'" - echo `ssh $sshoptions $host -l $user "$RDIFFBACKUP -V | grep rdiff-backup"` + echo `ssh $sshoptions $host -l $user "$RDIFFBACKUP -V | grep rdiff-backup | cut -d. -f1,2"` fi } -- 2.30.2 From 1d0fa1faa4789d89e475ccad9432369ebd0b2dce Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 5 Aug 2007 15:20:34 +0000 Subject: [PATCH 07/16] dup: cleanup unused var. git-svn-id: http://code.autistici.org/svn/backupninja/trunk@476 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/dup | 2 -- 1 file changed, 2 deletions(-) diff --git a/handlers/dup b/handlers/dup index 8e0367d..edb43ac 100644 --- a/handlers/dup +++ b/handlers/dup @@ -129,8 +129,6 @@ execstr_clientpart="/" set -o noglob -symlinks_warning="Maybe you have mixed symlinks and '*' in this statement, which is not supported." - # excludes for i in $exclude; do str="${i//__star__/*}" -- 2.30.2 From be4d10a7b00db3d2e504b4d94f0c15db03480b11 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 13 Aug 2007 01:55:16 +0000 Subject: [PATCH 08/16] typo in backupninja.1 git-svn-id: http://code.autistici.org/svn/backupninja/trunk@477 758a04ac-41e6-0310-8a23-8373a73cc35d --- man/backupninja.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/backupninja.1 b/man/backupninja.1 index f9d2ecc..53b1e3c 100644 --- a/man/backupninja.1 +++ b/man/backupninja.1 @@ -89,7 +89,7 @@ Runs the action configuration ACTION_FILE and exits. .SH CONFIGURATION General settings are configured in /etc/backupninja.conf. In this file you -can set the log level and change the default directory locations. See \fBbackupnina.conf(5)\fP. +can set the log level and change the default directory locations. See \fBbackupninja.conf(5)\fP. To preform the actual backup actions, backupninja processes each action configuration file in /etc/backup.d according to the file's suffix. See \fBbackup.d(5)\fP. -- 2.30.2 From 2bca513c38c70cd7a56bef23512183629e91bade Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 12 Oct 2007 17:06:09 +0000 Subject: [PATCH 09/16] fixed autotools build, broken since r466, inhandlers/Makefile.am git-svn-id: http://code.autistici.org/svn/backupninja/trunk@478 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/Makefile.am | 87 +++++++++++++++++++- handlers/{dup.helper => dup.helper.in} | 0 handlers/{dup => dup.in} | 0 handlers/{ldap.helper => ldap.helper.in} | 0 handlers/{ldap => ldap.in} | 0 handlers/{maildir => maildir.in} | 0 handlers/{makecd.helper => makecd.helper.in} | 0 handlers/{makecd => makecd.in} | 0 handlers/{mysql.helper => mysql.helper.in} | 0 handlers/{mysql => mysql.in} | 0 handlers/{pgsql.helper => pgsql.helper.in} | 0 handlers/{pgsql => pgsql.in} | 0 handlers/{rdiff.helper => rdiff.helper.in} | 0 handlers/{rdiff => rdiff.in} | 0 handlers/{rsnap => rsnap.in} | 0 handlers/{rub => rub.in} | 0 handlers/{sh => sh.in} | 0 handlers/{svn => svn.in} | 0 handlers/{sys.helper => sys.helper.in} | 0 handlers/{sys => sys.in} | 0 handlers/{tar.helper => tar.helper.in} | 0 handlers/{tar => tar.in} | 0 handlers/{trac => trac.in} | 0 23 files changed, 84 insertions(+), 3 deletions(-) rename handlers/{dup.helper => dup.helper.in} (100%) rename handlers/{dup => dup.in} (100%) rename handlers/{ldap.helper => ldap.helper.in} (100%) rename handlers/{ldap => ldap.in} (100%) rename handlers/{maildir => maildir.in} (100%) rename handlers/{makecd.helper => makecd.helper.in} (100%) rename handlers/{makecd => makecd.in} (100%) rename handlers/{mysql.helper => mysql.helper.in} (100%) rename handlers/{mysql => mysql.in} (100%) rename handlers/{pgsql.helper => pgsql.helper.in} (100%) rename handlers/{pgsql => pgsql.in} (100%) rename handlers/{rdiff.helper => rdiff.helper.in} (100%) rename handlers/{rdiff => rdiff.in} (100%) rename handlers/{rsnap => rsnap.in} (100%) rename handlers/{rub => rub.in} (100%) rename handlers/{sh => sh.in} (100%) rename handlers/{svn => svn.in} (100%) rename handlers/{sys.helper => sys.helper.in} (100%) rename handlers/{sys => sys.in} (100%) rename handlers/{tar.helper => tar.helper.in} (100%) rename handlers/{tar => tar.in} (100%) rename handlers/{trac => trac.in} (100%) diff --git a/handlers/Makefile.am b/handlers/Makefile.am index b627f79..24efe89 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -1,7 +1,7 @@ -HANDLERS = dup dup.helper maildir mysql.helper rdiff sys makecd makecd.helper \ - rdiff.helper rsnap rub sys.helper ldap pgsql sh trac \ - ldap.helper mysql pgsql.helper svn +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 EXTRA_DIST = Makefile.am $(HANDLERS) @@ -11,3 +11,84 @@ edit = sed \ -e "s,@SED\@,$(SED),g" dist_pkgdata_DATA = $(HANDLERS) + +dup: $(srcdir)/dup.in + rm -f dup + $(edit) $(srcdir)/dup.in > dup + +dup.helper: $(srcdir)/dup.helper.in + rm -f dup.helper + $(edit) $(srcdir)/dup.helper.in > dup.helper + +ldap: $(srcdir)/ldap.in + rm -f ldap + $(edit) $(srcdir)/ldap.in > ldap + +ldap.helper: $(srcdir)/ldap.helper.in + rm -f ldap.helper + $(edit) $(srcdir)/ldap.helper.in > ldap.helper + +maildir: $(srcdir)/maildir.in + rm -f maildir + $(edit) $(srcdir)/maildir.in > maildir + +makecd: $(srcdir)/makecd.in + rm -f makecd + $(edit) $(srcdir)/makecd.in > makecd + +makecd.helper: $(srcdir)/makecd.helper.in + rm -f makecd.helper + $(edit) $(srcdir)/makecd.helper.in > makecd.helper + +mysql: $(srcdir)/mysql.in + rm -f mysql + $(edit) $(srcdir)/mysql.in > mysql + +mysql.helper: $(srcdir)/mysql.helper.in + rm -f mysql.helper + $(edit) $(srcdir)/mysql.helper.in > mysql.helper + +pgsql: $(srcdir)/pgsql.in + rm -f pgsql + $(edit) $(srcdir)/pgsql.in > pgsql + +pgsql.helper: $(srcdir)/pgsql.helper.in + rm -f pgsql.helper + $(edit) $(srcdir)/pgsql.helper.in > pgsql.helper + +rdiff: $(srcdir)/rdiff.in + rm -f rdiff + $(edit) $(srcdir)/rdiff.in > rdiff + +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 + +sh: $(srcdir)/sh.in + rm -f sh + $(edit) $(srcdir)/sh.in > sh + +svn: $(srcdir)/svn.in + rm -f svn + $(edit) $(srcdir)/svn.in > svn + +sys: $(srcdir)/sys.in + rm -f sys + $(edit) $(srcdir)/sys.in > sys + +sys.helper: $(srcdir)/sys.helper.in + rm -f sys.helper + $(edit) $(srcdir)/sys.helper.in > sys.helper + +trac: $(srcdir)/trac.in + rm -f trac + $(edit) $(srcdir)/trac.in > trac + diff --git a/handlers/dup.helper b/handlers/dup.helper.in similarity index 100% rename from handlers/dup.helper rename to handlers/dup.helper.in diff --git a/handlers/dup b/handlers/dup.in similarity index 100% rename from handlers/dup rename to handlers/dup.in diff --git a/handlers/ldap.helper b/handlers/ldap.helper.in similarity index 100% rename from handlers/ldap.helper rename to handlers/ldap.helper.in diff --git a/handlers/ldap b/handlers/ldap.in similarity index 100% rename from handlers/ldap rename to handlers/ldap.in diff --git a/handlers/maildir b/handlers/maildir.in similarity index 100% rename from handlers/maildir rename to handlers/maildir.in diff --git a/handlers/makecd.helper b/handlers/makecd.helper.in similarity index 100% rename from handlers/makecd.helper rename to handlers/makecd.helper.in diff --git a/handlers/makecd b/handlers/makecd.in similarity index 100% rename from handlers/makecd rename to handlers/makecd.in diff --git a/handlers/mysql.helper b/handlers/mysql.helper.in similarity index 100% rename from handlers/mysql.helper rename to handlers/mysql.helper.in diff --git a/handlers/mysql b/handlers/mysql.in similarity index 100% rename from handlers/mysql rename to handlers/mysql.in diff --git a/handlers/pgsql.helper b/handlers/pgsql.helper.in similarity index 100% rename from handlers/pgsql.helper rename to handlers/pgsql.helper.in diff --git a/handlers/pgsql b/handlers/pgsql.in similarity index 100% rename from handlers/pgsql rename to handlers/pgsql.in diff --git a/handlers/rdiff.helper b/handlers/rdiff.helper.in similarity index 100% rename from handlers/rdiff.helper rename to handlers/rdiff.helper.in diff --git a/handlers/rdiff b/handlers/rdiff.in similarity index 100% rename from handlers/rdiff rename to handlers/rdiff.in diff --git a/handlers/rsnap b/handlers/rsnap.in similarity index 100% rename from handlers/rsnap rename to handlers/rsnap.in diff --git a/handlers/rub b/handlers/rub.in similarity index 100% rename from handlers/rub rename to handlers/rub.in diff --git a/handlers/sh b/handlers/sh.in similarity index 100% rename from handlers/sh rename to handlers/sh.in diff --git a/handlers/svn b/handlers/svn.in similarity index 100% rename from handlers/svn rename to handlers/svn.in diff --git a/handlers/sys.helper b/handlers/sys.helper.in similarity index 100% rename from handlers/sys.helper rename to handlers/sys.helper.in diff --git a/handlers/sys b/handlers/sys.in similarity index 100% rename from handlers/sys rename to handlers/sys.in diff --git a/handlers/tar.helper b/handlers/tar.helper.in similarity index 100% rename from handlers/tar.helper rename to handlers/tar.helper.in diff --git a/handlers/tar b/handlers/tar.in similarity index 100% rename from handlers/tar rename to handlers/tar.in diff --git a/handlers/trac b/handlers/trac.in similarity index 100% rename from handlers/trac rename to handlers/trac.in -- 2.30.2 From 867f8614da4ac8fed4fe7630fa8c17a491ece7c5 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 12 Oct 2007 17:14:34 +0000 Subject: [PATCH 10/16] fixed Trac#11 git-svn-id: http://code.autistici.org/svn/backupninja/trunk@479 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 6 ++++-- src/backupninja.in | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50e4760..62df6f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ version 0.9.5 -- unreleased ninjareport . Added first draft of method to aggregate reports from many servers into - one email. Requires logtail, rsync, configuration of reporthost, + one email. Requires logtail, rsync, configuration of reporthost, reportdirectory and reportuser in backupninja.conf. Configure cron to run once a day, and individual backupninjas not to report by email their status, then enjoy one email report from all hosts, rather than multiple @@ -9,7 +9,9 @@ version 0.9.5 -- unreleased . Fixed checks on configuration files permissions, since the patch applied to fix #370396 broke this, especially for configuration files created with permissions 000 by an older ninjahelper version. - . Enhanced portability for other platforms + . Enhanced portability for other platforms + . Fixed Trac#11 (quoting needed to prevent shell expansion, broke the + toint function sometimes) handler changes ldap: . Fixed shell command quoting issues, missing 'then' clauses, cleaned up diff --git a/src/backupninja.in b/src/backupninja.in index ef959f2..0cd186a 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -178,7 +178,7 @@ function tolower() { # simple to integer function function toint() { - echo "$1" | tr -d [:alpha:] + echo "$1" | tr -d '[:alpha:]' } # -- 2.30.2 From af3ba54d834cb1b0a08b0389a46a774e0a241608 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 12 Oct 2007 17:42:46 +0000 Subject: [PATCH 11/16] Fixed reportspace option (Trac#10) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@480 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + src/backupninja.in | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62df6f8..ea8d6c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ version 0.9.5 -- unreleased . Enhanced portability for other platforms . Fixed Trac#11 (quoting needed to prevent shell expansion, broke the toint function sometimes) + . Fixed reportspace option (Trac#10) handler changes ldap: . Fixed shell command quoting issues, missing 'then' clauses, cleaned up diff --git a/src/backupninja.in b/src/backupninja.in index 0cd186a..34c0bd6 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -546,10 +546,9 @@ if [ $doit == 1 ]; then for i in $(ls "$configdirectory"); do backuploc=$(grep ^directory "$configdirectory"/"$i" | @AWK@ '{print $3}') if [ "$backuploc" != "$previous" ]; then - mountdev=$(mount | grep "$backuploc" | @AWK@ '{print $1}') - df -h "$mountdev" + df -h "$backuploc" previous="$backuploc" - fi + fi done fi } | mail -s "backupninja: $hostname $subject" $reportemail -- 2.30.2 From 998a570e903db86a1348d6c7524dc3532c603e7b Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 12 Oct 2007 17:48:23 +0000 Subject: [PATCH 12/16] forgot to add CLEANFILES to handlers/Makefile.am git-svn-id: http://code.autistici.org/svn/backupninja/trunk@481 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/handlers/Makefile.am b/handlers/Makefile.am index 24efe89..710b25e 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -3,6 +3,8 @@ 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 +CLEANFILES = $(HANDLERS) + EXTRA_DIST = Makefile.am $(HANDLERS) edit = sed \ -- 2.30.2 From 7180ff5e5f66a273a7ff6478907c812b2bd8e23b Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 15 Oct 2007 20:55:59 +0000 Subject: [PATCH 13/16] Support duplicity >= 0.4.3 invocation syntax git-svn-id: http://code.autistici.org/svn/backupninja/trunk@482 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 3 +++ handlers/dup.in | 29 ++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea8d6c4..1d0ac1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,9 @@ version 0.9.5 -- unreleased toint function sometimes) . Fixed reportspace option (Trac#10) handler changes + dup: + . Support duplicity >= 0.4.3 invocation syntax (--ssh-command option + is not supported anymore) ldap: . Fixed shell command quoting issues, missing 'then' clauses, cleaned up compress=yes to be less redundant and not create empty uncompressed file diff --git a/handlers/dup.in b/handlers/dup.in index edb43ac..9848cbc 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -70,22 +70,37 @@ fi ### COMMAND-LINE MANGLING ### -# duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option) duplicity_version="`duplicity --version | @AWK@ '{print $2}'`" duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`" duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`" duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`" -if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 2 ]; then - sftpoptions="$sshoptions" -fi + +# 1. duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option) +# 2. duplicity >= 0.4.3 replaces --ssh-command with --ssh-options, which: +# - is passed to scp and sftp commands by duplicity +# - has a special syntax we can not feed the command line with +# so we don't use it: since this version does not use the ssh command anymore, +# we keep compatibility with our previous config files by passing $sshoptions to +# --scp-command and --sftp-command ourselves scpoptions="$sshoptions" [ "$bandwidthlimit" == 0 ] || scpoptions="$scpoptions -l $bandwidthlimit" -if [ -z "$sftpoptions" ]; then - execstr="$options --no-print-statistics --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions' " +execstr="$options --no-print-statistics " + +# < 0.4.2 : only uses ssh and scp +if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -le 2 ]; then + execstr="$execstr --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions' " +# >= 0.4.2 : also uses sftp, --sftp-command option is now supported else - execstr="$options --no-print-statistics --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' --ssh-command 'ssh $sshoptions' " + sftpoptions="$sshoptions" + # == 0.4.2 : uses ssh, scp and sftp + if [ "$duplicity_major" -eq 0 -a "$duplicity_minor" -eq 4 -a "$duplicity_sub" -eq 2 ]; then + execstr="$execstr --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' --ssh-command 'ssh $sshoptions' " + # >= 0.4.3 : uses only scp and sftp, --ssh-command option is not supported anymore + else + execstr="$execstr --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' " + fi fi # deal with symmetric or asymmetric (public/private key pair) encryption -- 2.30.2 From f4c0d8df575db034459d381457ff57051ce982f1 Mon Sep 17 00:00:00 2001 From: micah Date: Thu, 1 Nov 2007 23:54:08 +0000 Subject: [PATCH 14/16] add some debian bug numbers to Changelog for reference git-svn-id: http://code.autistici.org/svn/backupninja/trunk@483 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d0ac1f..d227b0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,8 @@ version 0.9.5 -- unreleased is not supported anymore) ldap: . Fixed shell command quoting issues, missing 'then' clauses, cleaned up - compress=yes to be less redundant and not create empty uncompressed file + compress=yes to be less redundant and not create empty uncompressed + file (Closes: #394935) mysql: . Fixed case where odd combination of configuration options caused sqldump backups to get overwritten with an empty file (Closes: #402679) @@ -49,7 +50,8 @@ 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 + updated examples/Makefile.am and handlers/Makefile.am to include rsnap/rub + files (Closes: #440554) version 0.9.4 -- October 6th, 2006 -- 2.30.2 From 8fe6f59b8b6aa18aac6865d657425ee38799432f Mon Sep 17 00:00:00 2001 From: micah Date: Fri, 2 Nov 2007 00:12:04 +0000 Subject: [PATCH 15/16] added ignore_version option to rdiff handler to enable you override the version check git-svn-id: http://code.autistici.org/svn/backupninja/trunk@484 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 5 +++-- examples/example.rdiff | 10 ++++++++++ handlers/rdiff.in | 16 +++++++++------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d227b0d..ba68c07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,10 +28,11 @@ version 0.9.5 -- unreleased . Support configuring PGSQLUSER for real, and document it a bit; this broken support actually prevented pgsql handler to work for VServers (Closes: #396578) - rdiff: + rdiff-backup: . Added cstream support to allow for bandwidth limiting . Handle "keep = yes" to disable old backups removal (Closes: #424633) - . Ignore rdiff-backup minor versions (thanks Sami Haahtinen) + . Add configuration option to allow you to disable the version check + as in some instances this may be an ok scenario (Closes: #424632) rub . Fixed typo in rub handler that caused it to not work . Changed to use lib/vserver code diff --git a/examples/example.rdiff b/examples/example.rdiff index c327fd6..3767f9b 100644 --- a/examples/example.rdiff +++ b/examples/example.rdiff @@ -20,6 +20,16 @@ ## -t option for more information. 62500 bytes = 500 Kb (.5 Mb) # bwlimit = 62500 +## should backupninja ignore the version differences between source and remote +## rdiff-backup? (default: no) +## This could be useful if the version differences between rdiff-backup instances +## on remote and local side are different, and you are certain there are no +## problems in using mis-matched versions and want to get beyond this check. +## An example usage could be the remote side has its authorized_keys configured +## with command="rdiff-backup --server" to allow for restricted yet automated +## password-less backups +# ignore_version = no + ###################################################### ## source section ## (where the files to be backed up are coming from) diff --git a/handlers/rdiff.in b/handlers/rdiff.in index 46cae49..aa02a55 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -32,12 +32,12 @@ function get_version() { # if user or host is missing, returns the local version. if [ "$#" -lt 2 ]; then debug "$RDIFFBACKUP -V" - echo `$RDIFFBACKUP -V | cut -d. -f1,2` + echo `$RDIFFBACKUP -V` else local user=$1 local host=$2 debug "ssh $sshoptions $host -l $user '$RDIFFBACKUP -V'" - echo `ssh $sshoptions $host -l $user "$RDIFFBACKUP -V | grep rdiff-backup | cut -d. -f1,2"` + echo `ssh $sshoptions $host -l $user "$RDIFFBACKUP -V | grep rdiff-backup"` fi } @@ -127,11 +127,13 @@ if [ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]; then test_connection $destuser $desthost fi -# see that rdiff-backup has the same version at the source and destination -sourceversion=`get_version $sourceuser $sourcehost` -destversion=`get_version $destuser $desthost` -if [ "$sourceversion" != "$destversion" ]; then - fatal "rdiff-backup does not have the same version at the source and at the destination." +if [ $ignore_version != "yes" ]; then + # see that rdiff-backup has the same version at the source and destination + sourceversion=`get_version $sourceuser $sourcehost` + destversion=`get_version $destuser $desthost` + if [ "$sourceversion" != "$destversion" ]; then + fatal "rdiff-backup does not have the same version at the source and at the destination." + fi fi # source specific checks -- 2.30.2 From b742c96f2a2649f481fbaa85d7023c708c627094 Mon Sep 17 00:00:00 2001 From: micah Date: Fri, 2 Nov 2007 00:52:55 +0000 Subject: [PATCH 16/16] added nodata option to mysql handler, thanks to Daniel Bonniot (Closes: 408829) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@485 758a04ac-41e6-0310-8a23-8373a73cc35d --- AUTHORS | 2 +- ChangeLog | 4 ++++ examples/example.mysql | 7 +++++++ handlers/mysql.in | 30 ++++++++++++++++++++++++------ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 541e949..79e338a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,7 +15,7 @@ rhatto -- rub handler and patches Patches: cmccallum@thecsl.org -Daniel.Bonniot@inria.fr +Daniel.Bonniot@inria.fr -- mysql ignores and nodata Brad Fritz -- trac patch garcondumonde@riseup.net Martin Krafft madduck@debian.org -- admingroup patch diff --git a/ChangeLog b/ChangeLog index ba68c07..5aa1fd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,10 @@ version 0.9.5 -- unreleased mysql: . Fixed case where odd combination of configuration options caused sqldump backups to get overwritten with an empty file (Closes: #402679) + . Added 'nodata' option to enable you to specify tables that you want to omit + the data from a backup, but still backup the table structure. This is very + useful in cases where tables contain large amounts of cache data. See the + example.mysql for options, thanks Daniel Bonniot (Closes: #408829) pgsql: . Support configuring PGSQLUSER for real, and document it a bit; this broken support actually prevented pgsql handler to work for VServers diff --git a/examples/example.mysql b/examples/example.mysql index 25750ad..d7ab8b6 100644 --- a/examples/example.mysql +++ b/examples/example.mysql @@ -53,6 +53,13 @@ compress = yes # which databases to backup. should either be the word 'all' or a # space separated list of database names. # +# nodata = < table1 table2 table3 > (no default) +# only dump the structure for the database tables listed here, this means +# no data contained in these tables will be dumped. This is very useful +# to backup databases that have tables with cache stored in tables that +# isn't necessary to backup, but you still need the structure to exist +# on a restore +# # backupdir = < path/to/destination > (default = /var/backups/mysql) # where to dump the backups. hotcopy backups will be in a subdirectory # 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump' diff --git a/handlers/mysql.in b/handlers/mysql.in index de4e4c3..64b6f49 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -6,6 +6,7 @@ getconf backupdir /var/backups/mysql getconf databases all getconf ignores +getconf nodata getconf dbhost localhost getconf hotcopy no getconf sqldump no @@ -47,7 +48,7 @@ fi ## This only works for mysqldump at the moment ignore='' -for i in $ignores; do +for i in $ignores $nodata; do ignore="$ignore --ignore-table=$i" done @@ -243,10 +244,27 @@ then fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" fi fi -fi + fi for db in $databases do + DUMP_BASE="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names" + + # Dumping structure and data + DUMP="$DUMP_BASE $ignore $db" + + # If requested, dump only the table structure for this database + if echo "$nodata" | grep -E '(^|[[:space:]])'"$db\." >/dev/null + then + # Get the structure of the tables, without data + DUMP_STRUCT="$DUMP_BASE --no-data $db" + for qualified_table in $nodata + do + table=$( expr match "$qualified_table" "$db\.\([^\w]*\)" ) + DUMP_STRUCT="$DUMP_STRUCT $table" + done + DUMP="( $DUMP; $DUMP_STRUCT )" + fi if [ $usevserver = yes ] then # Test to make sure mysqld is running, if it is not sqldump will not work @@ -255,9 +273,9 @@ fi fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" fi if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $vroot$dumpdir/${db}.sql.gz" + execstr="$VSERVER $vsname exec $DUMP | $GZIP > $vroot$dumpdir/${db}.sql.gz" else - execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db -r $vroot$dumpdir/${db}.sql" + execstr="$VSERVER $vsname exec $DUMP -r $vroot$dumpdir/${db}.sql" fi else # Test to make sure mysqld is running, if it is not sqldump will not work @@ -266,9 +284,9 @@ fi fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" fi if [ "$compress" == "yes" ]; then - execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $dumpdir/${db}.sql.gz" + execstr="$DUMP | $GZIP > $dumpdir/${db}.sql.gz" else - execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db -r $dumpdir/${db}.sql" + execstr="$DUMP -r $dumpdir/${db}.sql" fi fi debug "su $user -c \"$execstr\"" -- 2.30.2