Esempio n. 1
0
def main():
    parser = argparse.ArgumentParser()
    log_group = parser.add_mutually_exclusive_group()
    default_verbose = hasattr(sys, 'winver')
    log_group.add_argument(
        '-v', '--verbose', default=default_verbose, action='store_true',
        dest='print_log', help='print logs')
    log_group.add_argument(
        '--silent', action='store_false', dest='print_log',
        help='suppress logs')
    args = parser.parse_args()

    try:
        daemon.setup()
        if args.print_log:
            daemon.set_logger(additional=sys.stdout)
        else:
            daemon.set_logger()
        try:
            daemon.start_daemon()
            while True:
                time.sleep(60*60)
        finally:
            daemon.stop_daemon()
    except KeyboardInterrupt:
        sys.exit()
Esempio n. 2
0
def main():
    parser = argparse.ArgumentParser()
    log_group = parser.add_mutually_exclusive_group()
    default_verbose = hasattr(sys, 'winver')
    log_group.add_argument('-v',
                           '--verbose',
                           default=default_verbose,
                           action='store_true',
                           dest='print_log',
                           help='print logs')
    log_group.add_argument('--silent',
                           action='store_false',
                           dest='print_log',
                           help='suppress logs')
    args = parser.parse_args()

    try:
        daemon.setup()
        if args.print_log:
            daemon.set_logger(additional=sys.stdout)
        else:
            daemon.set_logger()
        try:
            daemon.start_daemon()
            while True:
                time.sleep(60 * 60)
        finally:
            daemon.stop_daemon()
    except KeyboardInterrupt:
        sys.exit()
Esempio n. 3
0
def main():
    try:
        daemon.setup()
        if ('-v' in sys.argv[1:]) or hasattr(sys, 'winver'):
            daemon.set_logger(additional=sys.stdout)
        else:
            daemon.set_logger()
        try:
            daemon.start_daemon()
            while True:
                time.sleep(60 * 60)
        finally:
            daemon.stop_daemon()
    except KeyboardInterrupt:
        sys.exit()
Esempio n. 4
0
def main():
    try:
        daemon.setup()
        if ('-v' in sys.argv[1:]) or hasattr(sys, 'winver'):
            daemon.set_logger(additional=sys.stdout)
        else:
            daemon.set_logger()
        try:
            daemon.start_daemon()
            while True:
                time.sleep(60*60)
        finally:
            daemon.stop_daemon()
    except KeyboardInterrupt:
        sys.exit()