Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50640 views
#!/usr/bin/env python

import os

target = "/home/salvus/vm/images/bup/bups-dc2/"

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,9):
    host = '10.3.%s.5'%i
    print host
    cmd2("rsync -axvH  --bwlimit 20000 --delete root@%s:/bup/bups/ %s/%s/"%(host, target, host))
    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))