From a79d18f1925a4d164ae5db08818e4a49b4795032 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 31 May 2011 23:40:15 -0300 Subject: Updating rsync handler --- files/handlers/rsync | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'files') diff --git a/files/handlers/rsync b/files/handlers/rsync index 3d5f22f..9da6d92 100644 --- a/files/handlers/rsync +++ b/files/handlers/rsync @@ -35,7 +35,7 @@ # mountpoint = backup partition mountpoint or backup main folder (either local or remote) # backupdir = folder relative do $mountpoint where the backup should be stored (local or remote) # format = specify backup storage format: short, long or mirror (i.e, no rotations) -# days = for short storage format, specify the number of backup increments (min = 5) +# days = for short storage format, specify the number of backup increments (min = 2, set to 1 or less to disable) # keepdaily = for long storage format, specify the number of daily backup increments # keepweekly = for long storage format, specify the number of weekly backup increments # keepmonthly = for long storage format, specify the number of monthly backup increments @@ -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 @@ -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 @@ -284,6 +284,9 @@ function eval_config { excludes="$excludes --exclude=$path" done + # Make sure we'll run bash at the destination + ssh_cmd="$ssh_cmd /bin/bash" + } function rotate_short { @@ -293,18 +296,18 @@ function rotate_short { local keep="$2" local metadata="`dirname $folder`/metadata" - if [[ "$keep" -lt 4 ]]; then - error "Rotate: minimum of 4 rotations" - exit 1 + # No rotations + if [[ "$keep" -lt 1 ]]; then + return fi if [ -d $folder.$keep ]; then $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 @@ -328,9 +331,9 @@ function rotate_short_remote { local metadata="`dirname $folder`/metadata" local keep="$2" - if [[ "$2" -lt 4 ]]; then - error "Rotate: minimum of 4 rotations" - exit 1 + # No rotations + if [[ "$keep" -lt 1 ]]; then + return fi ( @@ -911,7 +914,7 @@ function set_rsync_options { if [ "$from" == "local" ] || [ "$dest" == "local" ]; then # rsync options for local sources or destinations - rsync_options="$rsync_options" + rsync_options=($rsync_options) fi if [ "$from" == "remote" ] || [ "$dest" == "remote" ]; then -- cgit v1.2.3