def rsync_to_backup(game, region):
print("??????????????...")
sys.stdout.flush()
time.sleep(30)
config = ConfigReader(game, region)
rsync_module = config.get("rsync_module")
rsync_root = config.get("rsync_root")
rsync_backup_ip = config.get("rsync_backup_ip")
if rsync_module == "" or rsync_root == "" or rsync_backup_ip == "" :
raise Exception('rsync config is not proper in the game config file')
with cd(rsync_root), settings(user='root'), hide("stdout"):
run('''rsync -art -R --delete --out-format="%n" --password-file=/etc/rsyncd.secret ./ {}::{}'''.format(rsync_backup_ip, rsync_module))
#for i in range(3):
# with cd(rsync_root), settings(user='root'), hide("stdout"):
# out = run('''rsync -art -R --dry-run --delete --out-format="%n" --password-file=/etc/rsyncd.secret ./ {}::{}'''.format(rsync_backup_ip, rsync_module), timeout=120)
#
# if out.strip() != "":
# print("??????????????, ??60s?????...")
# sys.stdout.flush()
# time.sleep(60)
# else:
# print("??????!")
# break
#else:
# print("[WARNING]: ?????????, 30s??????version.lua, ????????!!!!!!!")
# sys.stdout.flush()
# time.sleep(30)
评论列表
文章目录