Comment 3 for bug 1040995

Revision history for this message
Julian Gilbey (jdg) wrote :

Better than Rafael's hack is the following: in common/snapshots.py, take_snapshot returns a success status. This function is called by the take_snapshot function in common/backintime.py, but the return value is ignored. So instead, take_snapshot in common/backintime.py should read:

def take_snapshot( cfg, force = True ):
    logger.openlog()
    tools.load_env(cfg)
    ret = snapshots.Snapshots( cfg ).take_snapshot( force )
    logger.closelog()
    return ret

and then in the start_app loop in common/backintime.py do something like the following:

        if arg == '--backup' or arg == '-b':
            ret = take_snapshot( cfg, True )
            if ret:
                sys.exit(0)
            else:
                sys.exit(1)

        if arg == '--backup-job':
            ret = take_snapshot( cfg, False )
            if ret:
                sys.exit(0)
            else:
                sys.exit(1)