diff options
author | intrigeri <intrigeri@boum.org> | 2011-04-26 11:00:02 +0200 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2011-04-26 11:00:02 +0200 |
commit | cdcc2bc5c9a28c5eaa0f26fca7aa3a20872689e0 (patch) | |
tree | 662f270c227c601735c521f7e91d65f484c38f76 | |
parent | d9f2fca055e54ca9d90fd9d41d9d87e307ecfdf7 (diff) | |
download | backupninja-cdcc2bc5c9a28c5eaa0f26fca7aa3a20872689e0.tar.gz backupninja-cdcc2bc5c9a28c5eaa0f26fca7aa3a20872689e0.tar.bz2 |
Do arithmetic using bash rather than bc (Closes: #603173)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | handlers/rsync.in | 6 | ||||
-rw-r--r-- | handlers/wget | 6 |
3 files changed, 7 insertions, 6 deletions
@@ -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 |