Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support gzip

  • Loading branch information...
commit 58db9aa970aa241e60b9597df86208fbbbbed24b 1 parent 93d334e
@kazuho authored
Showing with 18 additions and 5 deletions.
  1. +9 −2 ssh_blockdiff_dump
  2. +9 −3 ssh_lvm_dump
View
11 ssh_blockdiff_dump
@@ -1,10 +1,14 @@
#! /bin/sh
# check args
+if [ "$1" = "-z" ] ; then
+ USE_GZIP=1
+ shift
+fi
SSH_ARGS="$1"
REMOTE_FILE="$2"
if [ ! "$REMOTE_FILE" ] ; then
- echo "Usage: $0 user@host remote_file [5< prev_digest_file] 6> digest_file > backup_file" >&2
+ echo "Usage: $0 [-z] user@host remote_file [5< prev_digest_file] 6> digest_file > backup_file" >&2
exit 1
fi
if [ ! -e "/dev/fd/6" ] ; then
@@ -46,10 +50,13 @@ fi
if [ "$BLOCKSIZE" ] ; then
CMD="BLOCKSIZE=$BLOCKSIZE $CMD"
fi
+if [ "$USE_GZIP" ] ; then
+ CMD="$CMD | gzip ; exit \`test \"\${PIPESTATUS[0]}\" -eq 0 -a \"\$?\" -eq 0\`"
+fi
if [ "$VERBOSE" ] ; then
echo "issuing $CMD" >&2
fi
-ssh $SSH_ARGS $CMD
+ssh $SSH_ARGS "$CMD"
EXIT_CODE=$?
# transfer md5
View
12 ssh_lvm_dump
@@ -1,11 +1,13 @@
#! /bin/sh
-# usage: ssh_lvm_dump root@host lv_path
-
export BLOCKSIZE=1048576
SS_NAME="lvm_dump"
# check args
+if [ "$1" = "-z" ] ; then
+ SSH_BLOCKDIFF_ARGS="-z"
+ shift
+fi
SSH_ARGS="$1"
LV_PATH="$2"
if [ ! "$LV_PATH" ] ; then
@@ -14,12 +16,15 @@ if [ ! "$LV_PATH" ] ; then
fi
# setup variables
-SS_PATH=`dirname $LV_PATH`"/$SS_NAME"
+SS_PATH="`dirname $LV_PATH`/$SS_NAME"
SSH_BLOCKDIFF_DUMP=`dirname $0`
if [ "$SSH_BLOCKDIFF_DUMP" ] ; then
SSH_BLOCKDIFF_DUMP="$SSH_BLOCKDIFF_DUMP/"
fi
SSH_BLOCKDIFF_DUMP="$SSH_BLOCKDIFF_DUMPssh_blockdiff_dump"
+if [ "$SSH_BLOCKDIFF_ARGS" ] ; then
+ SSH_BLOCKDIFF_DUMP="$SSH_BLOCKDIFF_DUMP $SSH_BLOCKDIFF_ARGS"
+fi
if [ ! "$SNAPSHOT_SIZE" ] ; then
SNAPSHOT_SIZE="10G"
fi
@@ -34,6 +39,7 @@ fi
# dump
if [ "$EXIT_CODE" -eq 0 ] ; then
+ echo "running: $SSH_BLOCKDIFF_DUMP \"$SSH_ARGS\" \"$SS_PATH\"..." >&2
$SSH_BLOCKDIFF_DUMP "$SSH_ARGS" "$SS_PATH"
EXIT_CODE=$?
fi
Please sign in to comment.
Something went wrong with that request. Please try again.