コード例 #1
0
ファイル: Start.py プロジェクト: rsantellan/scripts
    #  , 'type'      : 'mysqldump'
    #  , 'db_user'   : 'root'
    #  , 'db_pass'   : '<mysql-password>'
    #  , 'db_host'   : 'sql.machine.com'
    #  , 'db_port'   : 9999
    #  , 'local_dir' : 'mysqldump-test'
    #  },
]

if __name__ == "__main__":
    logger = MyLogger()
    logger.doLog("starting!!")
    backupUtils = BackupUtils(logger)
    backupUtils.checkPythonVersion()
    backupUtils.checkOperativeSystem()
    backupUtils.checkRootDirectory(root_backup_dir)
    backupUtils.checkCommands(["rdiff-backup", "rm", "tar", "bzip2"])
    backupObjectsList = []
    # Doing this right now is nicer to the user: thanks to this he doesn't need to wait the end of the (X)th backup to get the error about the (X+1)th
    for backup in backup_list:
        # Check datas and requirement for each backup
        backup = backupUtils.parseBackupDefinition(backup)
        backup_folders = backupUtils.returnDirectoryList(root_backup_dir, backup["local_dir"])
        backupUtils.checkDirectories(root_backup_dir, backup["local_dir"])
        if backup["type"] == "":
            continue
        if backup["type"] in ["FTP", "FTPS"]:
            is_ftps = False
            if backup["type"] == "FTPS":
                is_ftps = True
            ftp = FtpHandler(