Ejemplo n.º 1
0
def mysqldump(user, password, cnt_full_name, cnt_name, dest_path):
    dest_full_path = dest_path + "/" + cnt_name + ".sql.gz"
    command = "docker exec -i " + cnt_full_name + " mysqldump -u " + user + " -p'" + password + \
              "' --all-databases --add-drop-database --routines -E --triggers --single-transaction | gzip > " + dest_full_path
    shell.retry_run([command], 3)
    statinfo = os.stat(dest_full_path)
    logging.info("Saved mysql db: " + dest_full_path + " using : " + str(statinfo.st_size/1024/1024) + " MB")
    return True
Ejemplo n.º 2
0
def backup(app_path, dst_path):
    app_data_path = app_path + "/data"
    backup_cmd = rdiff_backup + " --verbosity 1 --exclude-device-files --exclude-fifos --exclude-sockets " \
                                "--exclude-if-present .backupignore " + app_data_path + " " + dst_path
    shell.retry_run([backup_cmd], 3)

    remove_old_cmd = rdiff_backup + " --verbosity 1 --remove-older-than " + remove_older_than + " --force " + dst_path
    shell.retry_run([remove_old_cmd], 3)