#!/usr/bin/python3 """ .. moduleauthor:: Eric Torres Command-Line Arguments ====================== A daemon that waits to run backup jobs and manages a Repository on the local system. backupd listens on a specified port for a backup job sent by the backup script and TODO inspect python-daemon for use with this script """ import argparse import daemon import logging import rbackup.logging from rbackup.struct.repository import Repository # ========== Constants ========== # ========== Functions ========== def parse_cmdline_arguments(**kwargs): """Parse command line arguments passed to the script. All kwargs are passed to ArgumentParser.parse_args(). :rtype: argparse.Namespace object """ parser = argparse.ArgumentParser() parser.add_argument("repository", help="repository to back up to", metavar="repo") return parser.parse_args(**kwargs) # ========== Logging Setup ========== syslog = logging.getLogger("rbackup") syslog.setLevel(logging.DEBUG) # ========== Main Program ========== if __name__ == "__main__": args = parse_cmdline_arguments() stdout_handler, stderr_handler = rbackup.logging.retrieve_console_handlers( debug=args.debug ) syslog.addHandler(stdout_handler) syslog.addHandler(stderr_handler) with daemon.DaemonContext(): pass