Example #1
0
def run_backup():
    """
    Main method that performs the backup.
    """
    commandArgs = getArgs()
    if commandArgs.version:
        print("caatinga version: " + __version__)
        exit(0)

    settings = fn.getSettingsInstance(commandArgs)
    lockFileName = settings.hostName + "-caatinga"
    SettingsValidator().validate(settings)
    bkHome = fn.getBackupHome(settings.backupLocation, settings.hostName)
    lockFile = backup.getLockFile("/tmp", lockFileName)
    outWriter = fn.getOutputWriter(commandArgs.verbose)
    previousBackup = os.path.realpath(fn.getLatestLink(bkHome))

    fn.runHooks(settings.preBackupHooksDir)
    checkForRegisterOption(settings, commandArgs, bkHome)
    insureBackupLocationIsRegistered(
        settings.backupLocation,
        settings.hostName)
    lock(lockFile)
    runNonBackupFunctions(bkHome, settings, commandArgs, outWriter, lockFile)
    executeBackup(bkHome, previousBackup, settings, outWriter, lockFile)
    runMaintenanceFunctions(bkHome, settings, outWriter)
    fn.runHooks(settings.postBackupHooksDir)
Example #2
0
def run_lscaat():
    """
    Main method for lscaat.
    """
    (commandArgs, args) = getArgParser().parse_known_args()
    if commandArgs.version:
        print("lscaat version: " + caat.__version__)
        exit(0)
    settings = fn.getSettingsInstance(commandArgs)
    SettingsValidator().validate(settings)
    runOption(args, settings)