enable ssh compression, and remove sudo

master
Daniel Berteaud 12 years ago
parent b8b945187e
commit a76177028a
  1. 8
      blocksync.py

@ -4,15 +4,17 @@ Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <justin@bouncybouncy.net>
Copyright 2011 Robert Coup <robert@coup.net.nz>
Copyright 2012 Daniel Berteaud <daniel@firewal-services.com>
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)

Loading…
Cancel
Save