aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/sync-backups
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydractl/sync-backups')
-rwxr-xr-xshare/hydractl/sync-backups17
1 files changed, 13 insertions, 4 deletions
diff --git a/share/hydractl/sync-backups b/share/hydractl/sync-backups
index 844d630..63e11b4 100755
--- a/share/hydractl/sync-backups
+++ b/share/hydractl/sync-backups
@@ -7,12 +7,21 @@
BASENAME="`basename $0`"
VOLUME="$1"
MEDIA="/media/$VOLUME"
-BWLIMIT=${BWLIMIT:=32000}
+BWLIMIT=${BWLIMIT:=0}
IMAGES="/var/data/crypt/"
-RSYNC="ionice -c 3 nice -n 19 rsync -avH --delete --bwlimit=$BWLIMIT"
CP="ionice -c 3 nice -n 19 cp"
WHOAMI="`whoami`"
+# Set bandwidth limit
+if [ "$BWLIMIT" != "0" ]; then
+ BWLIMIT="--bwlimit=$BWLIMIT"
+else
+ BWLIMIT=""
+fi
+
+# Build rsync command line
+RSYNC="ionice -c 3 nice -n 19 rsync -avH --delete $BWLIMIT"
+
# Sync backups for a node.
function sync_backups_node {
if [ ! -z "$NODE" ]; then
@@ -75,13 +84,13 @@ fi
# Check volume name
if [ "$VOLUME" == "`hostname -f`" ]; then
- echo "volume is the hostname, cannot sync to myself"
+ echo "$BASENAME: volume is the hostname, cannot sync to myself"
exit 1
fi
# Check if it is mounted
if ! mount | grep -q $MEDIA; then
- echo "volume $MEDIA is not mounted"
+ echo "$BASENAME: volume $MEDIA is not mounted"
exit 1
fi