import time from bck4sync import BckTarGroup # Import configuration import bck_config from bck4sync import get_bcktargroups bckdir_list = bck_config.bckdir_list dest_dir = bck_config.dest_dir work_dir = bck_config.work_dir password = bck_config.password # Main logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG) logging.info('Start') if not os.path.exists(work_dir): os.makedirs(work_dir) srce_dir = bckdir_list[0] extract_dir = os.path.join(srce_dir, 'tmp') if not os.path.exists(extract_dir): os.makedirs(extract_dir) bck_name = os.path.basename(os.path.normpath(srce_dir)) bck_list = get_bcktargroups(bck_name, dest_dir) if bck_list: last_bck = bck_list[-1] my_backup = BckTarGroup(last_bck, \ srce_dir, dest_dir, work_dir, password) my_backup.extract(extract_dir)
# Output print "Nb elements: " + str(len(bck_submembers6)) if result: print 'Test 6: OK\n\n' else: print 'Test 6: KO' sys.exit(3) time.sleep(1) # Test 7 print "List existing backup" # Preparation print '-'*5 + ' Test 7 ' + '-'*5 result = True # Test bck_list = get_bcktargroups(prefix, dest_dir) # Output print bck_list last_bck = bck_list[-1] print last_bck if result: print 'Test 7: OK\n\n' else: print 'Test 7: KO' sys.exit(7) # Test 8 print "Delete oldest backups" print '-'*5 + ' Test 8 ' + '-'*5 # Preparation result = True
import time from bck4sync import BckTarGroup # Import configuration import bck_config from bck4sync import get_bcktargroups bckdir_list = bck_config.bckdir_list dest_dir = bck_config.dest_dir work_dir = bck_config.work_dir password = bck_config.password # Main logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG) logging.info('Start') if not os.path.exists(work_dir): os.makedirs(work_dir) for bckdir in bckdir_list: bckdir_base = os.path.basename(os.path.normpath(bckdir)) bck_list = get_bcktargroups(bckdir_base, dest_dir) if bck_list: last_bck = bck_list[-1] my_backup = BckTarGroup(last_bck, \ bckdir, dest_dir, work_dir, password) my_backup.update() else: logging.debug('Backup ' + bckdir_base) my_backup = BckTarGroup(bckdir_base, \ bckdir, dest_dir, work_dir, password) my_backup.create()
import sys import time from bck4sync import BckTarGroup # Import configuration import bck_config from bck4sync import get_bcktargroups bckdir_list = bck_config.bckdir_list dest_dir = bck_config.dest_dir work_dir = bck_config.work_dir password = bck_config.password # Main logging.basicConfig(format="%(asctime)s %(message)s", level=logging.DEBUG) logging.info("Start") if not os.path.exists(work_dir): os.makedirs(work_dir) srce_dir = bckdir_list[0] extract_dir = os.path.join(srce_dir, "tmp") if not os.path.exists(extract_dir): os.makedirs(extract_dir) bck_name = os.path.basename(os.path.normpath(srce_dir)) bck_list = get_bcktargroups(bck_name, dest_dir) if bck_list: last_bck = bck_list[-1] my_backup = BckTarGroup(last_bck, srce_dir, dest_dir, work_dir, password) my_backup.extract(extract_dir)