예제 #1
0
파일: saku.py 프로젝트: disunbow/saku
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()
예제 #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()
예제 #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()
예제 #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()