From a76177028aa0411eb670bf9c95cb3b7cecc82df4 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 15 May 2012 23:12:38 +0200 Subject: [PATCH] enable ssh compression, and remove sudo --- blocksync.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blocksync.py b/blocksync.py index 9235d3b..d7d8760 100644 --- a/blocksync.py +++ b/blocksync.py @@ -4,15 +4,17 @@ Synchronise block devices over the network Copyright 2006-2008 Justin Azoff Copyright 2011 Robert Coup +Copyright 2012 Daniel Berteaud License: GPL Getting started: * Copy blocksync.py to the home directory on the remote host -* Make sure your remote user can either sudo or is root itself. +* Make sure your remote user write in the dest block device. + (root or with sudo for example) * Make sure your local user can ssh to the remote host * Invoke: -sudo python blocksync.py /dev/source user@remotehost /dev/dest +blocksync /dev/source user@remotehost /dev/dest """ import sys @@ -62,7 +64,7 @@ def sync(srcdev, dsthost, dstdev=None, blocksize=1024 * 1024): dstdev = srcdev print "Block size is %0.1f MB" % (float(blocksize) / (1024 * 1024)) - cmd = ['ssh', '-c', 'blowfish', dsthost, 'sudo', 'python', 'blocksync.py', 'server', dstdev, '-b', str(blocksize)] + cmd = ['ssh', '-C', dsthost, 'blocksync', 'server', dstdev, '-b', str(blocksize)] print "Running: %s" % " ".join(cmd) p = subprocess.Popen(cmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)