From c0c02efafd0eb34355aa72e2f14f22ccd81018e9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 12 Sep 2010 23:26:08 +0200 Subject: rdiff: support reading include/exclude patterns from files. --- handlers/rdiff.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'handlers') diff --git a/handlers/rdiff.in b/handlers/rdiff.in index 60386fa..e391edd 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -219,7 +219,10 @@ SAVEIFS=$IFS IFS=$(echo -en "\n\b") for i in $exclude; do str="${i//__star__/*}" - execstr="${execstr}--exclude '$str' " + case "$str" in + @*) execstr="${execstr}--exclude-globbing-filelist '${str#@}' " ;; + *) execstr="${execstr}--exclude '$str' " ;; + esac done IFS=$SAVEIFS # includes @@ -228,7 +231,10 @@ IFS=$(echo -en "\n\b") for i in $include; do [ "$i" != "/" ] || fatal "Sorry, you cannot use 'include = /'" str="${i//__star__/*}" - execstr="${execstr}--include '$str' " + case "$str" in + @*) execstr="${execstr}--include-globbing-filelist '${str#@}' " ;; + *) execstr="${execstr}--include '$str' " ;; + esac done IFS=$SAVEIFS -- cgit v1.2.3 From eff27ce1cd0cd4f25d23c7d51bfd5283b30882db Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 20 Sep 2010 22:10:13 -0300 Subject: Fixing long rotation at rsync handler --- handlers/rsync.in | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'handlers') diff --git a/handlers/rsync.in b/handlers/rsync.in index fea7e7b..537fd4c 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -384,14 +384,14 @@ function rotate_long { for rottype in daily weekly monthly; do seconds=$((seconds_${rottype})) - dir="$backuproot/$rottype" - metadata="$backuproot/metadata/$rottype.1" - mkdir -p $metadata + metadata="$backuproot/metadata/$rottype" + + mkdir -p $metadata.1 if [ ! -d $dir.1 ]; then echo "Debug: $dir.1 does not exist, skipping." continue 1 - elif [ ! -f $metadata/created ] && [ ! -f $metadata/rotated ]; then + elif [ ! -f $metadata.1/created ] && [ ! -f $metadata.1/rotated ]; then echo "Warning: metadata does not exist for $dir.1. This backup may be only partially completed. Skipping rotation." continue 1 fi @@ -401,10 +401,10 @@ function rotate_long { [ "$oldest" == "" ] && oldest=0 for (( i=$oldest; i > 0; i-- )); do if [ -d $dir.$i ]; then - if [ -f $metadata/created ]; then - created=`tail -1 $metadata/created` - elif [ -f $metadata/rotated ]; then - created=`tail -1 $metadata/rotated` + if [ -f $metadata.$i/created ]; then + created=`tail -1 $metadata.$i/created` + elif [ -f $metadata.$i/rotated ]; then + created=`tail -1 $metadata.$i/rotated` else created=0 fi @@ -414,8 +414,9 @@ function rotate_long { if [ ! -d $dir.$next ]; then echo "Debug: $rottype.$i --> $rottype.$next" $nice mv $dir.$i $dir.$next - mkdir -p $backuproot/metadata/$rottype.$next - date +%c%n%s > $backuproot/metadata/$rottype.$next/rotated + mkdir -p $metadata.$next + date +%c%n%s > $metadata.$next/rotated + rm -f $metadata.$next/created else echo "Debug: skipping rotation of $dir.$i because $dir.$next already exists." fi @@ -485,14 +486,14 @@ function rotate_long_remote { for rottype in daily weekly monthly; do seconds=\$((seconds_\${rottype})) - dir="$backuproot/\$rottype" - metadata="$backuproot/metadata/\$rottype.1" - mkdir -p \$metadata + metadata="$backuproot/metadata/\$rottype" + + mkdir -p \$metadata.1 if [ ! -d \$dir.1 ]; then echo "Debug: \$dir.1 does not exist, skipping." continue 1 - elif [ ! -f \$metadata/created ] && [ ! -f \$metadata/rotated ]; then + elif [ ! -f \$metadata.1/created ] && [ ! -f \$metadata.1/rotated ]; then echo "Warning: metadata does not exist for \$dir.1. This backup may be only partially completed. Skipping rotation." continue 1 fi @@ -502,10 +503,10 @@ function rotate_long_remote { [ "\$oldest" == "" ] && oldest=0 for (( i=\$oldest; i > 0; i-- )); do if [ -d \$dir.\$i ]; then - if [ -f \$metadata/created ]; then - created=\`tail -1 \$metadata/created\` - elif [ -f \$metadata/rotated ]; then - created=\`tail -1 \$metadata/rotated\` + if [ -f \$metadata.\$i/created ]; then + created=\`tail -1 \$metadata.\$i/created\` + elif [ -f \$metadata.\$i/rotated ]; then + created=\`tail -1 \$metadata.\$i/rotated\` else created=0 fi @@ -515,8 +516,9 @@ function rotate_long_remote { if [ ! -d \$dir.\$next ]; then echo "Debug: \$rottype.\$i --> \$rottype.\$next" $nice mv \$dir.\$i \$dir.\$next - mkdir -p $backuproot/metadata/\$rottype.\$next - date +%c%n%s > $backuproot/metadata/\$rottype.\$next/rotated + mkdir -p \$metadata.\$next + date +%c%n%s > \$metadata.\$next/rotated + rm -f \$metadata.\$next/created else echo "Debug: skipping rotation of \$dir.\$i because \$dir.\$next already exists." fi @@ -528,7 +530,7 @@ function rotate_long_remote { done max=\$((keepdaily+1)) - if [ \$keepweekly -gt 0 -a -d $backuproot/daily.\$max -a ! -d \$backuproot/weekly.1 ]; then + if [ \$keepweekly -gt 0 -a -d $backuproot/daily.\$max -a ! -d $backuproot/weekly.1 ]; then echo "Debug: daily.\$max --> weekly.1" $nice mv $backuproot/daily.\$max $backuproot/weekly.1 mkdir -p $backuproot/metadata/weekly.1 -- cgit v1.2.3 From 2bf727c1407fa7bbf724f0259c4ff064a8444b86 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 25 Sep 2010 16:27:11 -0300 Subject: Don't remove created metadata after rotation at rsync --- handlers/rsync.in | 2 -- 1 file changed, 2 deletions(-) (limited to 'handlers') diff --git a/handlers/rsync.in b/handlers/rsync.in index 537fd4c..7b06c24 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -416,7 +416,6 @@ function rotate_long { $nice mv $dir.$i $dir.$next mkdir -p $metadata.$next date +%c%n%s > $metadata.$next/rotated - rm -f $metadata.$next/created else echo "Debug: skipping rotation of $dir.$i because $dir.$next already exists." fi @@ -518,7 +517,6 @@ function rotate_long_remote { $nice mv \$dir.\$i \$dir.\$next mkdir -p \$metadata.\$next date +%c%n%s > \$metadata.\$next/rotated - rm -f \$metadata.\$next/created else echo "Debug: skipping rotation of \$dir.\$i because \$dir.\$next already exists." fi -- cgit v1.2.3 From 7355535ee18efc472f5a598b8474e8d05765d6f1 Mon Sep 17 00:00:00 2001 From: Jacob Anawalt Date: Mon, 11 Oct 2010 18:53:00 -0600 Subject: Enable pg_dump format option. The format option of pg_dump enables tar and custom archive file formats in addition to the default plain-text file containing SQL commands. When either the tar or custom format are selected the behaviour of database=all is changed to no longer dump a single file via pg_dumpall. Instead pg_dumpall is called once to export the "global" data (roles & tablespaces) and then pg_dump is called once for each non-template table in the database. To support the GZIP and GZIP_OPTS variables in backupninja and to give the default --rsyncable gzip compression flag a chance at working on a PostgreSQL backup, the custom output is forced to not use compression. Instead compression is done via a pipe to gzip. Hopefully this benefits rsync and rdiff-backup style backups for reduced backup and storage costs that outweigh the restoration ones. --- etc/backupninja.conf.in | 1 + examples/example.pgsql | 13 ++++++ handlers/pgsql.helper.in | 30 ++++++++++++++ handlers/pgsql.in | 100 +++++++++++++++++++++++++++++++++++++++++------ src/backupninja.in | 1 + 5 files changed, 134 insertions(+), 11 deletions(-) (limited to 'handlers') diff --git a/etc/backupninja.conf.in b/etc/backupninja.conf.in index dee9fff..7e3d347 100644 --- a/etc/backupninja.conf.in +++ b/etc/backupninja.conf.in @@ -83,6 +83,7 @@ vservers = no # MYSQL=/usr/bin/mysql # MYSQLHOTCOPY=/usr/bin/mysqlhotcopy # MYSQLDUMP=/usr/bin/mysqldump +# PSQL=/usr/bin/psql # PGSQLDUMP=/usr/bin/pg_dump # PGSQLDUMPALL=/usr/bin/pg_dumpall # GZIP=/bin/gzip diff --git a/examples/example.pgsql b/examples/example.pgsql index 42f045e..5a4e02f 100644 --- a/examples/example.pgsql +++ b/examples/example.pgsql @@ -17,6 +17,19 @@ # compress = < yes | no > (default = yes) # if yes, compress the pg_dump/pg_dumpall output. +# format = < plain | tar | custom > (default = plain) +# plain - Output a plain-text SQL script file with the extension .sql. +# When dumping all databases, a single file is created via pg_dumpall. +# tar - Output a tar archive suitable for input into pg_restore. More +# flexible than plain and can be manipulated by standard Unix tools +# such as tar. Creates a globals.sql file and an archive per database. +# custom - Output a custom PostgreSQL pg_restore archive. This is the most +# flexible format allowing selective import and reordering of database +# objects at the time the database is restored via pg_restore. This +# option creates a globals.sql file containing the cluster role and +# other information dumped by pg_dumpall -g and a pg_restore file +# per selected database. See the pg_dump and pg_restore man pages. + ### You can also set the following variables in /etc/backupninja.conf: # PGSQLDUMP: pg_dump path (default: /usr/bin/pg_dump) # PGSQLDUMPALL: pg_dumpall path (default: /usr/bin/pg_dumpall) diff --git a/handlers/pgsql.helper.in b/handlers/pgsql.helper.in index ff1cfd4..82e6b48 100644 --- a/handlers/pgsql.helper.in +++ b/handlers/pgsql.helper.in @@ -67,6 +67,21 @@ pgsql_wizard() { pgsql_compress="compress = no" fi + # pg_dump format, defaults to plain, custom is recommended by PostgreSQL + menuBox "$pgsql_title" "Choose a pg_dump format:" \ + plain "Default plain-text sql script, use with psql." \ + tar "More flexible than the plain, use with pg_restore." \ + custom "The most flexible format, use with pg_restore." + if [ $? = 0 ]; then + result="$REPLY" + case "$result" in + "tar") pgsql_format="format = tar";; + "custom") pgsql_format="format = custom";; + *) pgsql_format = "format = plain";; + esac + fi + + # write config file get_next_filename $configdirectory/20.pgsql cat >> $next_filename < (default = plain) +# plain - Output a plain-text SQL script file with the extension .sql. +# When dumping all databases, a single file is created via pg_dumpall. +# tar - Output a tar archive suitable for input into pg_restore. More +# flexible than plain and can be manipulated by standard Unix tools +# such as tar. Creates a globals.sql file and an archive per database. +# custom - Output a custom PostgreSQL pg_restore archive. This is the most +# flexible format allowing selective import and reordering of database +# objects at the time the database is restored via pg_restore. This +# option creates a globals.sql file containing the cluster role and +# other information dumped by pg_dumpall -g and a pg_restore file +# per selected database. See the pg_dump and pg_restore man pages. +$pgsql_format + ### You can also set the following variables in backupninja.conf: +# PSQL: psql path (default: /usr/bin/psql) # PGSQLDUMP: pg_dump path (default: /usr/bin/pg_dump) # PGSQLDUMPALL: pg_dumpall path (default: /usr/bin/pg_dumpall) # PGSQLUSER: user running PostgreSQL (default: postgres) diff --git a/handlers/pgsql.in b/handlers/pgsql.in index 0b7badf..0564f5a 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -8,6 +8,8 @@ getconf backupdir /var/backups/postgres getconf databases all getconf compress yes getconf vsname +# format maps to pg_dump --format= option, old/default was plain +getconf format plain localhost=`hostname` @@ -35,17 +37,31 @@ fi # Make sure that the system to backup has the needed executables if [ $usevserver = yes ]; then debug "Examining vserver '$vsname'." - if [ "$databases" == "all" ]; then + if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \ fatal "Can't find $PGSQLDUMPALL in vserver $vsname." + elif [ "$format" != "plain" ]; then + [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \ + fatal "Can't find $PGSQLDUMPALL in vserver $vsname." + [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \ + fatal "Can't find $PGSQLDUMP in vserver $vsname." + [ -x "$vroot`$VSERVER $vsname exec which $PSQL`" ] || \ + fatal "Can't find $PSQL in vserver $vsname." else [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \ fatal "Can't find $PGSQLDUMP in vserver $vsname." fi else - if [ "$databases" == "all" ]; then + if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then + [ -x "`which $PGSQLDUMPALL`" ] || \ + fatal "Can't find $PGSQLDUMPALL." + elif [ "$format" != "plain" ]; then [ -x "`which $PGSQLDUMPALL`" ] || \ fatal "Can't find $PGSQLDUMPALL." + [ -x "`which $PGSQLDUMP`" ] || \ + fatal "Can't find $PGSQLDUMP." + [ -x "`which $PSQL`" ] || \ + fatal "Can't find $PSQL." else [ -x "`which $PGSQLDUMP`" ] || \ fatal "Can't find $PGSQLDUMP." @@ -71,6 +87,30 @@ chown $pguid $vroot$backupdir debug "chmod 700 $vroot$backupdir" chmod 700 $vroot$backupdir + +# If we are using the custom (best) or tar pg_dump format, and +# dumping "all" databases, we will substitute "all" for a list +# of all non-template databases to avoid the use of pg_dumpall. +dumpglobals="no" +if [ "$databases" = "all" ] && [ "$format" != "plain" ]; then + cmdprefix="" + if [ "$usevserver" = "yes" ]; then + cmdprefix="$VSERVER $vsname exec " + fi + execstr="${cmdprefix} su - $PGSQLUSER -c 'psql -AtU $PGSQLUSER -c \"SELECT datname FROM pg_database WHERE NOT datistemplate\"'" + debug execstr + dblist="" + for db in $(eval $execstr 2>&1); do + dblist="$dblist $db" + done + if [ "$dblist" != "" ]; then + databases="$dblist" + fi + # Dump globals (pg_dumpall -g) for roles and tablespaces + dumpglobals="yes" +fi + + # if $databases = all, use pg_dumpall if [ "$databases" == "all" ]; then if [ $usevserver = yes ]; then @@ -101,20 +141,58 @@ if [ "$databases" == "all" ]; then # else use pg_dump on each specified database else - for db in $databases; do + # If we're not doing plain format, database=all may now be database=list + # so we track the database=all selection in dumpglobals which tells us + # to also dump the roles and tablespaces via pg_dumpall -g + if [ "$dumpglobals" = "yes" ]; then + globalscmd="" + if [ "$compress" == "yes" ]; then + globalscmd="set -o pipefail ; $PGSQLDUMPALL -g | $GZIP $GZIP_OPTS > '$backupdir/globals.sql.gz'" + else + globalscmd="$PGSQLDUMPALL -g > '$backupdir/globals.sql'" + fi if [ $usevserver = yes ]; then - if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" - else - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\"" - fi + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$globalscmd\"" else - if [ "$compress" == "yes" ]; then - execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" + execstr="su - $PGSQLUSER -c \"$globalscmd\"" + fi + debug "$execstr" + if [ ! $test ]; then + output=`eval $execstr 2>&1` + code=$? + if [ "$code" == "0" ]; then + debug $output + info "Successfully finished pgsql globals (roles and tablespaces) dump" else - execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\"" + warning $output + warning "Failed to dump pgsql globals (roles and tablespaces)" fi fi + fi + for db in $databases; do + dumpext=".sql" + if [ "$format" != "plain" ]; then + dumpext="pg_dump" + fi + # To better support the backupninja global GZIP and rsync-friendly GZIP_OPTS + # the custom archive format is told to disable compression. The plain format + # is uncompressed by default and the tar format doesn't support pg_dump compression. + disablecustomcompress="" + if [ "$format" = "custom" ]; then + disablecustomcompress="--compress=0" + fi + dumpcmd="" + globalscmd="" + if [ "$compress" == "yes" ]; then + dumpcmd="set -o pipefail ; $PGSQLDUMP --format=$format ${disablecustomcompress} $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.${dumpext}.gz'" + else + dumpcmd="$PGSQLDUMP --format=$format ${disablecustomcompress} $db | > '$backupdir/${db}.${dumpext}'" + fi + if [ $usevserver = yes ]; then + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$dumpcmd\"" + else + execstr="su - $PGSQLUSER -c \"$dumpcmd\"" + fi debug "$execstr" if [ ! $test ]; then output=`eval $execstr 2>&1` diff --git a/src/backupninja.in b/src/backupninja.in index 789debd..aadc162 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -476,6 +476,7 @@ getconf MYSQLADMIN /usr/bin/mysqladmin getconf MYSQL /usr/bin/mysql getconf MYSQLHOTCOPY /usr/bin/mysqlhotcopy getconf MYSQLDUMP /usr/bin/mysqldump +getconf PSQL /usr/bin/psql getconf PGSQLDUMP /usr/bin/pg_dump getconf PGSQLDUMPALL /usr/bin/pg_dumpall getconf PGSQLUSER postgres -- cgit v1.2.3 From 55d9452da51c5695a96d3a6152577fe44e56ffef Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 12 Oct 2010 11:15:47 +0200 Subject: dup: use --tempdir option rather than TMPDIR environment variable. Closes Roundup bug #598. This breaks support of Debian etch. --- ChangeLog | 3 +++ handlers/dup.in | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index be2efac..7c88ad4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ version 0.9.9 -- UNRELEASED . Do not error out when no job is configured. Thanks to Jordi Mallach for the patch (Closes: #597684) handler changes + dup: + . Use --tempdir option rather than TMPDIR environment variable. + (Closes Roundup bug #598) postgresql: . Support various pg_dump formats in addition to pg_dumpall. Thanks to Jacob Anawalt for the patch. diff --git a/handlers/dup.in b/handlers/dup.in index 5216643..ae93898 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -185,7 +185,6 @@ if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -g fi ### Temporary directory -precmd= if [ -n "$tmpdir" ]; then if [ ! -d "$tmpdir" ]; then info "Temporary directory ($tmpdir) does not exist, creating it." @@ -194,7 +193,7 @@ if [ -n "$tmpdir" ]; then chmod 0700 "$tmpdir" fi info "Using $tmpdir as TMPDIR" - precmd="${precmd}TMPDIR=$tmpdir " + execstr_options="${execstr_options} --tempdir '$tmpdir'" fi ### Archive directory @@ -270,13 +269,13 @@ fi # cleanup if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then - debug "$precmd duplicity cleanup --force $execstr_options $execstr_serverpart" + debug "duplicity cleanup --force $execstr_options $execstr_serverpart" if [ ! $test ]; then export PASSPHRASE=$password export FTP_PASSWORD=$ftp_password output=`nice -n $nicelevel \ su -c \ - "$precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"` + "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then debug $output @@ -291,13 +290,13 @@ fi # remove-older-than if [ "$keep" != "yes" ]; then if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then - debug "$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" + debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" if [ ! $test ]; then export PASSPHRASE=$password export FTP_PASSWORD=$ftp_password output=`nice -n $nicelevel \ su -c \ - "$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"` + "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then debug $output @@ -311,14 +310,14 @@ if [ "$keep" != "yes" ]; then fi ### Backup command -debug "$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart" +debug "duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart" if [ ! $test ]; then outputfile=`maketemp backupout` export PASSPHRASE=$password export FTP_PASSWORD=$ftp_password output=`nice -n $nicelevel \ su -c \ - "$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"` + "duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"` exit_code=$? debug $output cat $outputfile | (while read output ; do -- cgit v1.2.3 From dc7f723e5c784379e8900f9dee4efaa3f851c0fb Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 12 Oct 2010 11:44:35 +0200 Subject: Remove support for duplicity < 0.4.4. Even etch-backports has a newer one. --- ChangeLog | 2 ++ handlers/dup.in | 92 ++++++++++++++++++--------------------------------------- 2 files changed, 31 insertions(+), 63 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 7c88ad4..afe0bae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ version 0.9.9 -- UNRELEASED dup: . Use --tempdir option rather than TMPDIR environment variable. (Closes Roundup bug #598) + . Remove support for duplicity < 0.4.4. Even etch-backports has + a newer one. postgresql: . Support various pg_dump formats in addition to pg_dumpall. Thanks to Jacob Anawalt for the patch. diff --git a/handlers/dup.in b/handlers/dup.in index ae93898..3ffc6ab 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -2,7 +2,7 @@ # vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # duplicity script for backupninja -# requires duplicity +# requires duplicity >= 0.4.4 # getconf options @@ -106,35 +106,14 @@ 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}'`" -### ssh/scp/sftp options -# 1. duplicity >= 0.4.2 needs --sftp-command -# (NB: sftp does not support the -l option) -# 2. duplicity 0.4.3 to 0.4.9 replace --ssh-command with --ssh-options, which is -# passed to scp and sftp commands by duplicity. 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 - +### ssh/scp/sftp options (duplicity < 0.4.3 is unsupported) scpoptions="$sshoptions" if [ "$bandwidthlimit" != 0 ]; then [ -z "$desturl" ] || warning 'The bandwidthlimit option is not used when desturl is set.' scpoptions="$scpoptions -l $bandwidthlimit" fi - -# < 0.4.2 : only uses ssh and scp -if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 2 ]; then - execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions'" -# >= 0.4.2 : also uses sftp, --sftp-command option is now supported -else - 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_options="${execstr_options} --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_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'" - fi -fi +sftpoptions="$sshoptions" +execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'" ### Symmetric or asymmetric (public/private key pair) encryption if [ -n "$encryptkey" ]; then @@ -162,12 +141,7 @@ fi # full backup. # If incremental==no, force a full backup anyway. if [ "$incremental" == "no" ]; then - # before 0.4.4, full was an option and not a command - if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then - execstr_options="${execstr_options} --full" - else - execstr_command="full" - fi + execstr_command="full" else # we're in incremental mode if [ "$increments" != "keep" ]; then @@ -210,10 +184,6 @@ if [ "$keep" != "yes" ]; then if [ "`echo $keep | tr -d 0-9`" == "" ]; then keep="${keep}D" fi - # before 0.4.4, remove-older-than was an option and not a command - if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then - execstr_options="${execstr_options} --remove-older-than $keep" - fi fi ### Source @@ -268,43 +238,39 @@ fi ### Cleanup commands (duplicity >= 0.4.4) # cleanup -if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then - debug "duplicity cleanup --force $execstr_options $execstr_serverpart" +debug "duplicity cleanup --force $execstr_options $execstr_serverpart" +if [ ! $test ]; then + export PASSPHRASE=$password + export FTP_PASSWORD=$ftp_password + output=`nice -n $nicelevel \ + su -c \ + "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"` + exit_code=$? + if [ $exit_code -eq 0 ]; then + debug $output + info "Duplicity cleanup finished successfully." + else + debug $output + warning "Duplicity cleanup failed." + fi +fi + +# remove-older-than +if [ "$keep" != "yes" ]; then + debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" if [ ! $test ]; then export PASSPHRASE=$password export FTP_PASSWORD=$ftp_password output=`nice -n $nicelevel \ - su -c \ - "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"` + su -c \ + "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then debug $output - info "Duplicity cleanup finished successfully." + info "Duplicity remove-older-than finished successfully." else debug $output - warning "Duplicity cleanup failed." - fi - fi -fi - -# remove-older-than -if [ "$keep" != "yes" ]; then - if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then - debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" - if [ ! $test ]; then - export PASSPHRASE=$password - export FTP_PASSWORD=$ftp_password - output=`nice -n $nicelevel \ - su -c \ - "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"` - exit_code=$? - if [ $exit_code -eq 0 ]; then - debug $output - info "Duplicity remove-older-than finished successfully." - else - debug $output - warning "Duplicity remove-older-than failed." - fi + warning "Duplicity remove-older-than failed." fi fi fi -- cgit v1.2.3 From a80d6f4a0cc96ebd4125ccc016d7dbb256ba992d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 12 Oct 2010 11:47:15 +0200 Subject: Make it clear duplicity >=0.4.9 is required when using a custom tmpdir. --- handlers/dup.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'handlers') diff --git a/handlers/dup.in b/handlers/dup.in index 3ffc6ab..e3475b8 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -2,7 +2,7 @@ # vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # duplicity script for backupninja -# requires duplicity >= 0.4.4 +# requires duplicity >= 0.4.4, and >= 0.4.9 when using a custom tmpdir. # getconf options -- cgit v1.2.3 From 9271e58a24a80b00ec57e9f4ed99ddd2ed80e3e0 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 1 Oct 2010 18:09:43 -0400 Subject: older versions (lenny) of lvm2 have a bug in vgcfgbackup that makes it so when you specify multiple volume groups to backup, it gives an error, saying you must set the %s template for the name. We are doing that, it just cannot handle it properly. This change routes around this issue, which has been fixed in later lvm2 releases, by passing only one argument to vgcfgbackup by taking all the volume groups that are found and running them through a for loop --- handlers/sys.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'handlers') diff --git a/handlers/sys.in b/handlers/sys.in index a92663e..fcf3e31 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -649,8 +649,11 @@ function doLvmBackup () { debug "$VGS --options vg_name --noheadings | @SED@ 's/^[ ]*//' | @SED@ 's/[ ]*$//' | tr '\n' ' '" vgs=`$VGS --options vg_name --noheadings | @SED@ 's/^[ ]*//' | @SED@ 's/[ ]*$//' | tr '\n' ' '` debug "Let's try to backup LVM metadata for detected volume groups: $vgs" - debug "$VGCFGBACKUP --file \"${lvmdir}\"/\'%s\' $vgs" - output=`$VGCFGBACKUP --file "${lvmdir}"/'%s' $vgs` + for vg in $vgs + do + debug "$VGCFGBACKUP --file \"${lvmdir}\"/\'%s\' $vg" + output=`$VGCFGBACKUP --file "${lvmdir}"/'%s' $vg` + done exit_code=$? debug $output case $exit_code in -- cgit v1.2.3 From 0b60b58153f352e6f0c7e8f52b0824720c2a4c05 Mon Sep 17 00:00:00 2001 From: Jacob Anawalt Date: Tue, 19 Oct 2010 13:37:10 -0600 Subject: Removed extra '.' in plain/sql dumps Removed an extra '.' in file names introduced by the pg_dump options patch, resulting in names like db..sql or db..sql.gz instead of just db.sql or db.sql.gz. --- handlers/pgsql.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'handlers') diff --git a/handlers/pgsql.in b/handlers/pgsql.in index 0564f5a..f68ec2f 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -170,7 +170,7 @@ else fi fi for db in $databases; do - dumpext=".sql" + dumpext="sql" if [ "$format" != "plain" ]; then dumpext="pg_dump" fi -- cgit v1.2.3 From 13f247afebde199ffb03d23e8662d362d5681ca6 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 7 Nov 2010 13:07:26 +0100 Subject: Fix reliance on bash for pipefail. (Closes: #602374) Thanks to Sergio Talens-Oliag for the bug report and patch. --- AUTHORS | 1 + ChangeLog | 7 +++++++ handlers/ldap.in | 2 +- handlers/mysql.in | 2 +- handlers/pgsql.in | 12 ++++++------ 5 files changed, 16 insertions(+), 8 deletions(-) (limited to 'handlers') diff --git a/AUTHORS b/AUTHORS index 5ca3087..90fa918 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,3 +37,4 @@ Chris Nolan -- maildir subdirectory expansion Dan Carley -- mysql bugfix Jordi Mallach -- do not error when no jobs are configured Jacob Anawalt -- pg_dump format option +Sergio Talens-Oliag -- pipefail fixes diff --git a/ChangeLog b/ChangeLog index f7bf585..8bcdc6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,10 +8,17 @@ version 0.9.9 -- UNRELEASED (Closes Roundup bug #598) . Remove support for duplicity < 0.4.4. Even etch-backports has a newer one. + ldap: + . Fix reliance on bash for pipefail. + mysql: + . Fix reliance on bash for pipefail. + Thanks to Sergio Talens-Oliag for the patch. + (Closes: #602374) postgresql: . Support various pg_dump formats in addition to pg_dumpall. Thanks to Jacob Anawalt for the patch. (Closes Roundup bug #2534) + . Fix reliance on bash for pipefail. rdiff: . Support reading include/exclude patterns from files using the "include @/etc/backup_includes" syntax (Closes Roundup bug diff --git a/handlers/ldap.in b/handlers/ldap.in index 83307ee..600f172 100644 --- a/handlers/ldap.in +++ b/handlers/ldap.in @@ -91,7 +91,7 @@ if [ "$ldif" == "yes" ]; then execstr="$execstr > $dumpdir/$dbsuffix.ldif" fi debug "$execstr" - output=`su root -c "set -o pipefail ; $execstr" 2>&1` + output=`su root -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1` code=$? if [ "$code" == "0" ]; then debug $output diff --git a/handlers/mysql.in b/handlers/mysql.in index 0282046..05ea396 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -303,7 +303,7 @@ then debug "su $user -c \"$execstr\"" if [ ! $test ] then - output=`su $user -c "set -o pipefail ; $execstr" 2>&1` + output=`su $user -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1` code=$? if [ "$code" == "0" ] then diff --git a/handlers/pgsql.in b/handlers/pgsql.in index f68ec2f..ff71ebc 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -115,13 +115,13 @@ fi if [ "$databases" == "all" ]; then if [ $usevserver = yes ]; then if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\"" else execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\"" fi else if [ "$compress" == "yes" ]; then - execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" + execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" else execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" fi @@ -152,9 +152,9 @@ else globalscmd="$PGSQLDUMPALL -g > '$backupdir/globals.sql'" fi if [ $usevserver = yes ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$globalscmd\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" else - execstr="su - $PGSQLUSER -c \"$globalscmd\"" + execstr="su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" fi debug "$execstr" if [ ! $test ]; then @@ -189,9 +189,9 @@ else dumpcmd="$PGSQLDUMP --format=$format ${disablecustomcompress} $db | > '$backupdir/${db}.${dumpext}'" fi if [ $usevserver = yes ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$dumpcmd\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" else - execstr="su - $PGSQLUSER -c \"$dumpcmd\"" + execstr="su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" fi debug "$execstr" if [ ! $test ]; then -- cgit v1.2.3 From 8098286aa1c8d751e7cf1872775a1bb41538624f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 13 Dec 2010 11:24:21 +0100 Subject: dup helper: fix separate signing key usecase. Thanks to Ian Beckwith for the patch. --- AUTHORS | 2 +- ChangeLog | 4 ++++ handlers/dup.helper.in | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'handlers') diff --git a/AUTHORS b/AUTHORS index 90fa918..9202931 100644 --- a/AUTHORS +++ b/AUTHORS @@ -29,7 +29,7 @@ Adam Monsen - spec file updates Matthew Palmer -- halt loglevel feature dan@garthwaite.org -- reportspace bugfix Tuomas Jormola -- "when = manual" option -Ian Beckwith -- dup bandwidthlimit fix +Ian Beckwith -- dup bandwidthlimit fix, dup helper fix Olivier Berger -- much work on the dup handler stefan -- dup support for Amazon S3 buckets maniacmartin -- rdiff confusing error message fix diff --git a/ChangeLog b/ChangeLog index 8bcdc6b..18d5429 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,10 @@ version 0.9.9 -- UNRELEASED . Fix long rotation. sys: . Route around broken vgcfgbackup not able to handle multiple VG arguments + helper changes + dup: + . Fix separate signing key usecase. Thanks to Ian Beckwith for + the patch. version 0.9.8 -- September 12, 2010 backupninja changes diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index e985c5e..12331a3 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -179,7 +179,7 @@ do_dup_gpg_signkey() { dup_gpg_onekeypair=no fi - if [ "$dup_gpg_onekeypair" == "no" }; then + if [ "$dup_gpg_onekeypair" == "no" ]; then # signkey ? REPLY= while [ -z "$REPLY" -o -z "$dup_gpg_signkey" ]; do -- cgit v1.2.3 From 8190b0dbc7581590a23d302ba06966aa17d9ba63 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 27 Jan 2011 18:59:39 +0100 Subject: rdiff.helper: generate 4096 bits RSA keys. --- ChangeLog | 2 ++ handlers/rdiff.helper.in | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 276467e..b66a589 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,8 @@ version 0.9.9 -- UNRELEASED dup: . Fix separate signing key usecase. Thanks to Ian Beckwith for the patch. + rdiff: + . Generate 4096 bits RSA keys. version 0.9.8.1 -- October 31, 2010 (boo!) backupninja changes diff --git a/handlers/rdiff.helper.in b/handlers/rdiff.helper.in index b5bb8bb..039799e 100644 --- a/handlers/rdiff.helper.in +++ b/handlers/rdiff.helper.in @@ -168,7 +168,7 @@ do_rdiff_ssh_con() { if [ ! -f /root/.ssh/id_dsa.pub -a ! -f /root/.ssh/id_rsa.pub ]; then echo "Creating local root's ssh key" - ssh-keygen -t dsa -f /root/.ssh/id_dsa -N "" + ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" echo "Done. hit return to continue" read fi -- cgit v1.2.3 From a036144de87424ad0cab8fa8491db44af40c0e16 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 27 Jan 2011 19:02:05 +0100 Subject: Documentation: recommend using 4096 bits RSA keys everywhere. --- ChangeLog | 2 ++ README | 4 ++-- examples/example.dup | 2 +- handlers/dup.helper.in | 2 +- man/backupninja.1 | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index b66a589..6063fa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,8 @@ version 0.9.9 -- UNRELEASED the patch. rdiff: . Generate 4096 bits RSA keys. + documentation changes + . Recommend using 4096 bits RSA keys everywhere. version 0.9.8.1 -- October 31, 2010 (boo!) backupninja changes diff --git a/README b/README index 8b01add..41d4186 100644 --- a/README +++ b/README @@ -201,8 +201,8 @@ In order for rdiff-backup to sync files over ssh unattended, you must create ssh keys on the source server and copy the public key to the remote user's authorized keys file. For example: - root@srchost# ssh-keygen -t dsa - root@srchost# ssh-copy-id -i /root/.ssh/id_dsa.pub backup@desthost + root@srchost# ssh-keygen -t rsa -b 4096 + root@srchost# ssh-copy-id -i /root/.ssh/id_rsa.pub backup@desthost Now, you should be able to ssh from user 'root' on srchost to user 'backup' on desthost without specifying a password. diff --git a/examples/example.dup b/examples/example.dup index 0ed5b2a..3eb4529 100644 --- a/examples/example.dup +++ b/examples/example.dup @@ -203,7 +203,7 @@ exclude = /var/cache/backupninja/duplicity ## warning: sftp does not support all scp options, especially -i; as ## a workaround, you can use "-o " ## an example setting would be: -## sshoptions = -o IdentityFile=/root/.ssh/id_dsa_duplicity +## sshoptions = -o IdentityFile=/root/.ssh/id_rsa_duplicity ## ## Default: # sshoptions = diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 12331a3..f85cf87 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -449,7 +449,7 @@ bandwidthlimit = $dup_bandwidth # passed directly to ssh, scp (and sftp in duplicity >=0.4.2) # warning: sftp does not support all scp options, especially -i; as # a workaround, you can use "-o " -#sshoptions = -o IdentityFile=/root/.ssh/id_dsa_duplicity +#sshoptions = -o IdentityFile=/root/.ssh/id_rsa_duplicity sshoptions = $dup_sshoptions # put the backups under this destination directory diff --git a/man/backupninja.1 b/man/backupninja.1 index 5622881..4363222 100644 --- a/man/backupninja.1 +++ b/man/backupninja.1 @@ -104,7 +104,7 @@ Then, vital parts of the file system, including /var/backups, are nightly pushed .TP In order for this to work (ie for diff-backup to run unattended), you must create ssh keys on the source server and copy the public key to the remote user's authorized keys file. For example: .br -root@srchost# ssh-keygen -t dsa +root@srchost# ssh-keygen -t rsa -b 4096 .br root@srchost# ssh-copy-id -i /root/.ssh/id_dsa.pub backup@desthost .TP -- cgit v1.2.3 From 2392094a242248f702ebfcb4644f623d2d3aedde Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 16 Feb 2011 08:22:10 +0100 Subject: Make units clearer (Closes Redmine bug #2737). --- ChangeLog | 2 ++ examples/example.dup | 4 ++-- examples/example.rsync | 2 +- handlers/dup.helper.in | 2 +- handlers/rsync.in | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 6063fa9..2a94593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,10 +26,12 @@ version 0.9.9 -- UNRELEASED #2370). Thanks to ale for the patch. rsync: . Fix long rotation. + . Make units clearer (Closes Redmine bug #2737) helper changes dup: . Fix separate signing key usecase. Thanks to Ian Beckwith for the patch. + . Make units clearer (Closes Redmine bug #2737) rdiff: . Generate 4096 bits RSA keys. documentation changes diff --git a/examples/example.dup b/examples/example.dup index 3eb4529..cc64790 100644 --- a/examples/example.dup +++ b/examples/example.dup @@ -191,9 +191,9 @@ exclude = /var/cache/backupninja/duplicity ## Default: # ftp_password = -## bandwith limit, in kbit/s ; default is 0, i.e. no limit +## bandwith limit, in Kbit/s ; default is 0, i.e. no limit ## if using 'desturl' above, 'bandwidthlimit' must not be set -## an example setting of 128 kbps would be: +## an example setting of 128 Kbit/s would be: ## bandwidthlimit = 128 ## ## Default: diff --git a/examples/example.rsync b/examples/example.rsync index 9053f3e..3c280ba 100644 --- a/examples/example.rsync +++ b/examples/example.rsync @@ -89,7 +89,7 @@ exclude_vserver = excluded_vserver2 # if set to 1, compress data on rsync (remote source only) #compress = 0 -# set a badnwidth limit in kbps (remote source only) +# set a badnwidth limit in KB/s (remote source only) #bandwidthlimit = # remote rsync program (remote source only) diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index f85cf87..5cd9dc6 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -442,7 +442,7 @@ keep = $dup_keep # bandwith limit, in kbit/s ; default is 0, i.e. no limit # if using 'desturl' above, 'bandwidthlimit' must not be set -# an example setting of 128 kbps would be: +# an example setting of 128 Kbit/s would be: #bandwidthlimit = 128 bandwidthlimit = $dup_bandwidth diff --git a/handlers/rsync.in b/handlers/rsync.in index 7b06c24..d35445e 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -60,7 +60,7 @@ # exclude_vserver = vserver-name (valid only if vservers = yes on backupninja.conf) # numericids = when set to 1, use numeric ids instead of user/group mappings on rsync # compress = if set to 1, compress data on rsync (remote source only) -# bandwidthlimit = set a badnwidth limit in kbps (remote source only) +# bandwidthlimit = set a badnwidth limit in KB/s (remote source only) # remote_rsync = remote rsync program (remote source only) # id_file = ssh key file (remote source only) # batch = set to "yes" to rsync use a batch file as source @@ -79,7 +79,7 @@ # port = remote port number (remote destination only) # user = remote user name (remote destination only) # id_file = ssh key file (remote destination only) -# bandwidthlimit = set a badnwidth limit in kbps (remote destination only) +# bandwidthlimit = set a badnwidth limit in KB/s (remote destination only) # remote_rsync = remote rsync program (remote dest only) # batch = set to "yes" to rsync write a batch file from the changes # batchbase = folder where the batch file should be written -- cgit v1.2.3 From 1bf46e1128d1e4b4f51f7e1c4a932d09d7e9b00b Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Wed, 20 Apr 2011 22:29:20 -0400 Subject: Add the tar handler to Makefile.am --- handlers/Makefile.am | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'handlers') diff --git a/handlers/Makefile.am b/handlers/Makefile.am index eaf4b9e..c9ad2ba 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 rsync sh svn sys sys.helper trac + rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper CLEANFILES = $(HANDLERS) @@ -90,3 +90,11 @@ trac: $(srcdir)/trac.in rm -f trac $(edit) $(srcdir)/trac.in > trac +tar: $(srcdir)/tar.in + rm -f tar + $(edit) $(srcdir)/tar.in > tar + +tar.helper: $(srcdir)/tar.helper.in + rm -f tar.helper + $(edit) $(srcdir)/tar.helper.in > tar.helper + -- cgit v1.2.3 From 6aca9c822b640372b0fad24d2a3a288ef2cd6a0f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 25 Apr 2011 18:55:58 +0200 Subject: All handlers: stop using "local VAR" outside functions. (Closes: #530647) --- ChangeLog | 2 ++ handlers/dup.in | 2 +- handlers/mysql.in | 4 ++-- handlers/pgsql.in | 4 ++-- handlers/rdiff.in | 2 +- handlers/svn.in | 4 ++-- handlers/sys.in | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 2a94593..29ce38d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ version 0.9.9 -- UNRELEASED action. Thanks to Olivier Berger for the patch. (Closes: #511300) handler changes + all handlers: + . Stop using "local VAR" outside functions. (Closes: #530647) dup: . Use --tempdir option rather than TMPDIR environment variable. (Closes Roundup bug #598) diff --git a/handlers/dup.in b/handlers/dup.in index e3475b8..1d345a3 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -51,7 +51,7 @@ fi ### VServers # If vservers are configured, check that the ones listed in $vsnames do exist. -local usevserver=no +usevserver=no if [ $vservers_are_available = yes ]; then if [ "$vsnames" = all ]; then vsnames="$found_vservers" diff --git a/handlers/mysql.in b/handlers/mysql.in index 05ea396..185a98a 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -24,8 +24,8 @@ getconf configfile /etc/mysql/debian.cnf # Decide if the handler should operate on a vserver or on the host. # In the former case, check that $vsname exists and is running. -local usevserver=no -local vroot +usevserver=no +vroot='' if [ $vservers_are_available = yes ]; then if [ -n "$vsname" ]; then # does it exist ? diff --git a/handlers/pgsql.in b/handlers/pgsql.in index ff71ebc..a50d3c7 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -15,8 +15,8 @@ localhost=`hostname` # Decide if the handler should operate on a vserver or on the host. # In the former case, check that $vsname exists and is running. -local usevserver=no -local vroot +usevserver=no +vroot='' if [ $vservers_are_available = yes ]; then if [ -n "$vsname" ]; then # does it exist ? diff --git a/handlers/rdiff.in b/handlers/rdiff.in index e391edd..c2f5aa0 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -115,7 +115,7 @@ fi ### CHECK CONFIG ### # If vservers are configured, check that the ones listed in $vsnames do exist. -local usevserver=no +usevserver=no if [ $vservers_are_available = yes ]; then if [ "$vsnames" = all ]; then vsnames="$found_vservers" diff --git a/handlers/svn.in b/handlers/svn.in index 5e5531a..bb70eee 100644 --- a/handlers/svn.in +++ b/handlers/svn.in @@ -14,8 +14,8 @@ error=0 # Decide if the handler should operate on a vserver or on the host. # In the former case, check that $vsname exists and is running. -local usevserver=no -local vroot +usevserver=no +vroot='' if [ $vservers_are_available = yes ]; then if [ -n "$vsname" ]; then # does it exist ? diff --git a/handlers/sys.in b/handlers/sys.in index fcf3e31..101745c 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -103,7 +103,7 @@ getconf lvm no getconf vsnames all # If vservers are configured, check that the ones listed in $vsnames are running. -local usevserver=no +usevserver=no if [ $vservers_are_available = yes ]; then if [ "$vsnames" = all ]; then vsnames="$found_vservers" -- cgit v1.2.3 From a1c2229e1a0d476fc02626f1326fa263955b17ee Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Sun, 21 Nov 2010 10:07:36 +0100 Subject: Proposed feature to address https://labs.riseup.net/code/issues/2492 --- ChangeLog | 3 +++ handlers/dup.helper.in | 14 ++++++++++++-- handlers/dup.in | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 29ce38d..8d2ed5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ version 0.9.9 -- UNRELEASED (Closes Roundup bug #598) . Remove support for duplicity < 0.4.4. Even etch-backports has a newer one. + . Now support remove-all-but-n-full command for duplicity >= + 0.9.10 to allow removal of increments for older full backups + (Closes #2492) ldap: . Fix reliance on bash for pipefail. mysql: diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 5cd9dc6..2594b0b 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -124,6 +124,7 @@ do_dup_dest() { formItem "keep" "$dup_keep" formItem "incremental" "$dup_incremental" formItem "increments" "$dup_increments" + formItem "keepincroffulls" "$dup_keepincroffulls" formItem "bandwidthlimit" "$dup_bandwidth" formItem "sshoptions" "$dup_sshoptions" formDisplay @@ -141,8 +142,9 @@ do_dup_dest() { dup_keep=${thereply[3]} dup_incremental=${thereply[4]} dup_increments=${thereply[5]} - dup_bandwidth=${thereply[6]} - dup_sshoptions=${thereply[7]} + dup_keepincroffulls=${thereply[6]} + dup_bandwidth=${thereply[7]} + dup_sshoptions=${thereply[8]} done set +o noglob @@ -424,6 +426,14 @@ increments = $dup_increments #keep = yes keep = $dup_keep +# for how many full backups do we keep their later increments ; +# default is all (keep all increments). +# increments for older full backups will be deleted : only the more +# recent ones (count provided) will be kept +#keepincrofulls = all +#keepincrofulls = 6 +keepincrofulls = $dup_keepincroffulls + # full destination URL, in duplicity format; if set, desturl overrides # sshoptions, destdir, desthost and destuser; it also disables testconnect and # bandwithlimit. For details, see duplicity manpage, section "URL FORMAT". diff --git a/handlers/dup.in b/handlers/dup.in index 1d345a3..b58d34d 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -26,6 +26,7 @@ setsection dest getconf incremental yes getconf increments 30 getconf keep 60 +getconf keepincroffulls all getconf desturl getconf awsaccesskeyid getconf awssecretaccesskey @@ -275,6 +276,30 @@ if [ "$keep" != "yes" ]; then fi fi +# remove-all-inc-of-but-n-full : remove increments of older full backups : only keep latest ones +if [ "$keep" != "yes" ]; then + if [ "$keepincroffulls" != "all" ]; then + if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 9 -a "$duplicity_sub" -ge 10 ]; then + debug "$precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart" + if [ ! $test ]; then + export PASSPHRASE=$password + export FTP_PASSWORD=$ftp_password + output=`nice -n $nicelevel \ + su -c \ + "$precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"` + exit_code=$? + if [ $exit_code -eq 0 ]; then + debug $output + info "Duplicity remove-all-inc-of-but-n-full finished successfully." + else + debug $output + warning "Duplicity remove-all-inc-of-but-n-full failed." + fi + fi + fi + fi +fi + ### Backup command debug "duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart" if [ ! $test ]; then -- cgit v1.2.3 From 573e803a07b81328bcc64a2cb08bab1831cc94a7 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Sun, 14 Nov 2010 14:20:55 +0100 Subject: Proposed feature to address https://labs.riseup.net/code/issues/2492 --- handlers/dup.helper.in | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'handlers') diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 2594b0b..413a4e7 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -426,6 +426,13 @@ increments = $dup_increments #keep = yes keep = $dup_keep +# for how many full backups do we keep their later increments ; +# default is 6. +# increments for older full backups will be deleted : only the more +# recent ones will be kept +#keepincrofulls = 6 +keepincrofulls = $dup_keepincroffulls + # for how many full backups do we keep their later increments ; # default is all (keep all increments). # increments for older full backups will be deleted : only the more -- cgit v1.2.3 From ca14175210a0f12ef4802f057d07530a989e82f7 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Sun, 14 Nov 2010 14:58:15 +0100 Subject: Now that there's some removal of increments for old fulls, we can keep fulls for a longer time, for instance 1Y which becomes default --- handlers/dup.helper.in | 4 ++-- handlers/dup.in | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'handlers') diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 413a4e7..98bce1c 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -419,10 +419,10 @@ incremental = $dup_incremental #increments = keep increments = $dup_increments -# how many days of data to keep ; default is 60 days. +# how many days of data to keep ; default is 1 year. # (you can also use the time format of duplicity) # 'keep = yes' means : do not delete old data, the remote host will take care of this -#keep = 60 +#keep = 1Y #keep = yes keep = $dup_keep diff --git a/handlers/dup.in b/handlers/dup.in index b58d34d..29fd866 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -25,8 +25,13 @@ getconf exclude setsection dest getconf incremental yes getconf increments 30 +<<<<<<< HEAD getconf keep 60 getconf keepincroffulls all +======= +getconf keep 1Y +getconf keepincroffulls 6 +>>>>>>> Now that there's some removal of increments for old fulls, we can keep fulls for a longer time, for instance 1Y which becomes default getconf desturl getconf awsaccesskeyid getconf awssecretaccesskey -- cgit v1.2.3 From 55fe213f9b968fc0a909adea57710e3ab7540230 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Mon, 25 Apr 2011 22:29:57 +0200 Subject: Fix merge problem --- handlers/dup.in | 5 ----- 1 file changed, 5 deletions(-) (limited to 'handlers') diff --git a/handlers/dup.in b/handlers/dup.in index 29fd866..b58d34d 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -25,13 +25,8 @@ getconf exclude setsection dest getconf incremental yes getconf increments 30 -<<<<<<< HEAD getconf keep 60 getconf keepincroffulls all -======= -getconf keep 1Y -getconf keepincroffulls 6 ->>>>>>> Now that there's some removal of increments for old fulls, we can keep fulls for a longer time, for instance 1Y which becomes default getconf desturl getconf awsaccesskeyid getconf awssecretaccesskey -- cgit v1.2.3 From b5b400aca66412bd026be2918b5d65f016661948 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Mon, 25 Apr 2011 22:38:28 +0200 Subject: Fix option name, and revert defaults to previous settings --- handlers/dup.helper.in | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'handlers') diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 98bce1c..38a57c0 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -419,27 +419,21 @@ incremental = $dup_incremental #increments = keep increments = $dup_increments -# how many days of data to keep ; default is 1 year. +# how many days of data to keep ; default is 60 days. # (you can also use the time format of duplicity) # 'keep = yes' means : do not delete old data, the remote host will take care of this +#keep = 60 #keep = 1Y #keep = yes keep = $dup_keep -# for how many full backups do we keep their later increments ; -# default is 6. -# increments for older full backups will be deleted : only the more -# recent ones will be kept -#keepincrofulls = 6 -keepincrofulls = $dup_keepincroffulls - # for how many full backups do we keep their later increments ; # default is all (keep all increments). # increments for older full backups will be deleted : only the more # recent ones (count provided) will be kept -#keepincrofulls = all -#keepincrofulls = 6 -keepincrofulls = $dup_keepincroffulls +#keepincroffulls = all +#keepincroffulls = 6 +keepincroffulls = $dup_keepincroffulls # full destination URL, in duplicity format; if set, desturl overrides # sshoptions, destdir, desthost and destuser; it also disables testconnect and -- cgit v1.2.3 From 8f70c54e0afc02c4f771bac365395c13d066bb7e Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 26 Apr 2011 10:31:39 +0200 Subject: Initialize dup_keepincroffulls as any other global variable. --- handlers/dup.helper.in | 1 + 1 file changed, 1 insertion(+) (limited to 'handlers') diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 38a57c0..7f82c2f 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -545,6 +545,7 @@ dup_wizard() { dup_incremental=yes dup_increments=30 dup_keep=60 + dup_keepincroffulls= dup_bandwidth= dup_sshoptions= dup_destdir="/backups/`hostname`" -- cgit v1.2.3 From cdcc2bc5c9a28c5eaa0f26fca7aa3a20872689e0 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 26 Apr 2011 11:00:02 +0200 Subject: Do arithmetic using bash rather than bc (Closes: #603173) --- ChangeLog | 1 + handlers/rsync.in | 6 +++--- handlers/wget | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 9cc1ffb..f1a90b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,7 @@ version 0.9.9 -- UNRELEASED rsync: . Fix long rotation. . Make units clearer (Closes Redmine bug #2737) + . Do arithmetic using bash rather than bc (Closes: #603173) helper changes dup: . Fix separate signing key usecase. Thanks to Ian Beckwith for diff --git a/handlers/rsync.in b/handlers/rsync.in index d35445e..d93411a 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -253,7 +253,7 @@ function eval_config { if [ -z "$days" ]; then keep="4" else - keep="`echo $days - 1 | bc -l`" + keep=$[$days - 1] fi fi @@ -302,9 +302,9 @@ function rotate_short { $nice $mv /$folder.$keep /$folder.tmp fi - for ((n=`echo "$keep - 1" | bc`; n >= 0; n--)); do + for ((n=$[$keep - 1]; n >= 0; n--)); do if [ -d $folder.$n ]; then - dest=`echo "$n + 1" | bc` + dest=$[$n + 1] $nice $mv /$folder.$n /$folder.$dest $touch /$folder.$dest mkdir -p $metadata/`basename $folder`.$dest diff --git a/handlers/wget b/handlers/wget index ebb391e..67425fc 100644 --- a/handlers/wget +++ b/handlers/wget @@ -88,9 +88,9 @@ function rotate { $nice $mv /$1.$2 /$1.tmp fi - for ((n=`echo "$2 - 1" | bc`; n >= 0; n--)); do + for ((n=$[$2 - 1]; n >= 0; n--)); do if [ -d $1.$n ]; then - dest=`echo "$n + 1" | bc` + dest=$[$n + 1] $nice $mv /$1.$n /$1.$dest $touch /$1.$dest fi @@ -128,7 +128,7 @@ fi if [ -z "$days" ]; then keep="4" else - keep="`echo $days - 1 | bc -l`" + keep=$[$days - 1] fi # lockfile setup -- cgit v1.2.3 From 5910e1ce812a7a4e2cff1445bffb17abe309b3c1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 26 Apr 2011 11:05:49 +0200 Subject: tar helper: default to store backups into /var/backups/. --- handlers/tar.helper.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'handlers') diff --git a/handlers/tar.helper.in b/handlers/tar.helper.in index cdbe03a..4a483be 100644 --- a/handlers/tar.helper.in +++ b/handlers/tar.helper.in @@ -17,7 +17,7 @@ tar_wizard() { tar_backupname="backupname = $REPLY" backupname="$REPLY" - inputBox "$tar_title" "Directory where to store the backups" "/net/backups/$backupname" + inputBox "$tar_title" "Directory where to store the backups" "/var/backups/tar/$backupname" [ $? = 1 ] && return tar_backupdir="backupdir = $REPLY" -- cgit v1.2.3 From d32cc2318ce6cc6fc634ef73b97d0bbebf2feea3 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 5 May 2011 09:16:59 +0200 Subject: sys: fix hwinfo (Closes: #625501) --- ChangeLog | 2 ++ handlers/sys.in | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index ad5ba59..2157afb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,8 @@ version 0.9.9 -- UNRELEASED . Fix long rotation. . Make units clearer (Closes Redmine bug #2737) . Do arithmetic using bash rather than bc (Closes: #603173) + sys: + . Fix hwinfo (Closes: #625501) tar: . Install by default. (Closes Redmine bug #2907) helper changes diff --git a/handlers/sys.in b/handlers/sys.in index 101745c..12d8f59 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -542,7 +542,7 @@ fi # if [ "$hardware" == "yes" ]; then - if [ "dohwinfo" == "yes" ]; then + if [ "$dohwinfo" == "yes" ]; then if [ -f $hardwarefile ]; then rm $hardwarefile fi -- cgit v1.2.3 From 49a5c563211685d00cd8de0a195ae26972c52bbd Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 15 May 2011 19:19:48 +0200 Subject: sys: fix gathering of information about loaded modules. cut is in /usr/bin actually. --- ChangeLog | 2 ++ handlers/sys.in | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'handlers') diff --git a/ChangeLog b/ChangeLog index 2157afb..87bf36b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,8 @@ version 0.9.9 -- UNRELEASED . Do arithmetic using bash rather than bc (Closes: #603173) sys: . Fix hwinfo (Closes: #625501) + . Fix gathering of information about loaded modules: + cut is in /usr/bin actually. tar: . Install by default. (Closes Redmine bug #2907) helper changes diff --git a/handlers/sys.in b/handlers/sys.in index 12d8f59..74133a3 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -350,7 +350,7 @@ STATUS="Getting kernel version:" catifexec "/bin/uname" "-a" STATUS="Checking module information:" catifexec "/sbin/lsmod" -for x in $(/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null +for x in $(/sbin/lsmod | /usr/bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null ) ; do STATUS="Checking module information $x:" catifexec "/sbin/modinfo" "$x" -- cgit v1.2.3