if __name__ == '__main__': file_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(os.path.dirname(file_dir))) try: from citizendesk.common.utils import setup_logger, get_logger, set_allowed_ips from citizendesk.common.utils import set_pid_path, set_daemon_name from citizendesk.common.utils import daemonize, set_user, cleanup, exit_handler from citizendesk.outgest.run import run_flask except: sys.stderr.write('citizen modules not installed\n') os._exit(1) params.use_specs() setup_logger(params.get_log_path()) set_pid_path(params.get_pid_path()) set_allowed_ips(params.get_allowed_ips()) set_daemon_name(DAEMON_NAME) atexit.register(cleanup) signal.signal(signal.SIGTERM, exit_handler) signal.signal(signal.SIGINT, exit_handler) if params.to_daemonize(): daemonize(params.get_home_dir(), params.get_pid_path()) set_user(params.get_user_id(), params.get_group_id(), params.get_pid_path()) logger = get_logger() try: logger.info('starting the ' + str(DAEMON_NAME))
if __name__ == '__main__': file_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.dirname(os.path.dirname(file_dir))) try: from citizendesk.common.utils import setup_logger, get_logger, set_allowed_ips from citizendesk.common.utils import set_pid_path, set_daemon_name from citizendesk.common.utils import daemonize, set_user, cleanup, exit_handler from citizendesk.ingest.url.run import run_flask except: sys.stderr.write('citizen modules not installed\n') os._exit(1) params.use_specs() setup_logger(params.get_log_path()) set_pid_path(params.get_pid_path()) set_allowed_ips(params.get_allowed_ips()) set_daemon_name(DAEMON_NAME) atexit.register(cleanup) signal.signal(signal.SIGTERM, exit_handler) signal.signal(signal.SIGINT, exit_handler) if params.to_daemonize(): daemonize(params.get_home_dir(), params.get_pid_path()) set_user(params.get_user_id(), params.get_group_id(), params.get_pid_path()) logger = get_logger() try: logger.info('starting the ' + str(DAEMON_NAME)) run_server()