Example #1
0
parser = optparse.ArgumentParser()
parser.add_option("-a",
                    dest = "silent",
                    action = "store_true",
                    help = "Run program in non-interactive mode")
parser.add_option("-c", "--config-file",
                    dest = "config_file",
                    action = "store",
                    help = "Specify the configuration file path")
parser.add_option("--ddboost",
                    dest = "ddboost",
                    action = "store_true"
                    help = "Use this option for ddboost backup")
options, args = parser.parse_args()

config = ConfigParser.Configparser()
config.read(options.config_file)

logging.info("Reading the configuration file")
database = config.get("conf", "database")
schama = config.get("conf", "schema")


if not dbname:
    logging.error("Database not specified in config_file... Exiting...")
    sys.exit()
"""
This function will get backup latest timestamp from gpcrondump_history table where it is completed successfully
and has used same backup options. So that we can compare the this timestamp with timestamp of this program start.
if backup key has lower value than program timestamp then we can consider that backup is failed.
"""