From 8f14b4f223acc923aa96459b32cdf3c880b2ebe3 Mon Sep 17 00:00:00 2001 From: Christian Urich Date: Sun, 4 Apr 2021 16:57:26 +0200 Subject: [PATCH] move local folder config in config.json --- backup.py | 5 +++-- config.json.example | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/backup.py b/backup.py index fbba00d..1496bc9 100644 --- a/backup.py +++ b/backup.py @@ -2,11 +2,12 @@ import json import os def main(): - backup_path = '/Users/Jowe1999/Desktop/test' with open('config.json', 'r') as config_file: config = json.load(config_file) - for host in config: + backup_path = config['local']['path'] + + for host in config['remote']: print('conect to ' + host) for service in config[host]: backup_dir = '{}/{}'.format(backup_path, service).lower() diff --git a/config.json.example b/config.json.example index 9f8c930..915ff3c 100644 --- a/config.json.example +++ b/config.json.example @@ -1,9 +1,14 @@ { - "host" : { - "service" : "path/to/backups/*" + "remote" : { + "host" : { + "service" : "path/to/backups/*" + }, + "host2" : { + "service1" : "path/to/backups/*", + "service2" : "path/to/backups/*" + } }, - "host2" : { - "service1" : "path/to/backups/*", - "service2" : "path/to/backups/*" + "local" : { + "path" : "/backup/storage/folder/" } } \ No newline at end of file