Browse Source

fix keys

master
Christian Urich 5 years ago
parent
commit
d19b6cd12c
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      backup.py

+ 7
- 5
backup.py View File

@ -7,18 +7,20 @@ def main():
backup_path = config['local']['path']
for host in config['remote']:
hosts = config['remote']
for host in hosts:
print('conect to ' + host)
for service in config[host]:
for service in hosts[host]:
backup_dir = '{}/{}'.format(backup_path, service).lower()
if not os.path.exists(backup_dir):
os.mkdir(backup_dir)
print('from ' + config[host][service] + ' to ' + backup_dir)
cmd = 'scp {}:{}/* {}'.format(host, config[host][service],
print('from ' + hosts[host][service] + ' to ' + backup_dir)
cmd = 'scp {}:{}/* {}'.format(host, hosts[host][service],
backup_dir)
print('({})'.format(cmd))
os.system(cmd)
cmd = 'ssh {} rm -f {}/* '.format(host, config[host][service],
cmd = 'ssh {} rm -f {}/* '.format(host, hosts[host][service],
backup_dir)
print('({})'.format(cmd))
os.system(cmd)


Loading…
Cancel
Save