diff options
Diffstat (limited to 'handlers')
-rw-r--r-- | handlers/dup.helper.in | 16 | ||||
-rw-r--r-- | handlers/dup.in | 27 | ||||
-rw-r--r-- | handlers/mysql.in | 4 | ||||
-rw-r--r-- | handlers/pgsql.in | 4 | ||||
-rw-r--r-- | handlers/rdiff.in | 2 | ||||
-rw-r--r-- | handlers/rsync.in | 6 | ||||
-rw-r--r-- | handlers/svn.in | 4 | ||||
-rwxr-xr-x | handlers/sys.in | 2 | ||||
-rw-r--r-- | handlers/tar.helper.in | 2 | ||||
-rw-r--r-- | handlers/wget | 6 |
10 files changed, 55 insertions, 18 deletions
diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 5cd9dc6..7f82c2f 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 @@ -421,9 +423,18 @@ increments = $dup_increments # (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 all (keep all increments). +# increments for older full backups will be deleted : only the more +# recent ones (count provided) will be kept +#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 # bandwithlimit. For details, see duplicity manpage, section "URL FORMAT". @@ -534,6 +545,7 @@ dup_wizard() { dup_incremental=yes dup_increments=30 dup_keep=60 + dup_keepincroffulls= dup_bandwidth= dup_sshoptions= dup_destdir="/backups/`hostname`" diff --git a/handlers/dup.in b/handlers/dup.in index e3475b8..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 @@ -51,7 +52,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" @@ -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 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/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/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" 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" 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 |