#!/usr/bin/env python
import os
target = "/home/salvus/vm/images/bup/bups"
if not os.path.exists(target):
os.makedirs(target)
def cmd(s):
print s
return os.popen(s).read()
def cmd2(s):
print s
if os.system(s):
print "WARNING!"
return
cmd("bup init")
for i in range(1,8):
target_dir = '10.1.%s.5'%i
if i == 4:
host = '10.1.%s.5'%i
port = 22
else:
host = 'cloud%s'%i
port = 2222
print host
cmd2("rsync -axvH -e 'ssh -o StrictHostKeyChecking=no -p %s' --bwlimit 100 --exclude='*/cache/' --delete root@%s:/bup/bups/ %s/%s/"%(port, host, target, target_dir))
cmd2("cd %s && mkdir -p ls-lt && time ls -lt --time-style=full-iso %s |grep -v ^total > ls-lt/%s"%(target, target_dir, target_dir))
import time; time.sleep(600)