Example #1
0
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)

Example #2
0
else:
    os.makedirs(dest_dir)
if os.path.exists(work_dir):
    rm_dir_content(work_dir)
else:
    os.makedirs(work_dir)
# Reinitialize dir_to_backup
if os.path.exists(dir_to_backup):
    rm_dir_content(dir_to_backup)
else:
    os.makedirs(dir_to_backup)
copytree(os.path.join(ref_dir, '0'), dir_to_backup)

fs_photo = take_fs_photo(srce_dir)
# Test
my_backup = BckTarGroup(prefix, srce_dir, dest_dir, work_dir, password)
my_backup.max_members_size = (50*1024)
my_backup.create()
# Result 1
result = True
backup_name = my_backup.name
if not my_backup.is_complete():
    result = False
else:
    bck_submembers = my_backup.getsubmembers()
    if fs_photo != bck_submembers:
        result = False
# Output 1
print "Nb elements: " + str(len(bck_submembers))
if result:
    print 'Test 1: OK\n\n'
Example #3
0
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()
Example #4
0
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)