def run(): try: log.init('client.log') context = daemonise.getContext( pidfile = _config['client-pid-file'], signal_map = { signal.SIGUSR1: 'terminate', signal.SIGHUP: configuration.reload, }, ) _log.debug('Entering running context...') with context: _log.info('Configuration file: {0}'.format(configuration.filename())) _log.info('Initializing ConSys client daemon...') # Install GLib reactor from twisted.internet import glib2reactor glib2reactor.install() from consys.common import app from consys.client import network, persistent app.startup() app.dispatch_loop() _log.info('Terminating ConSys client daemon...') except Exception: _log.exception('Unhandled exception in main thread, exiting')
def run(): try: log.init('server.log') context = daemonise.getContext( pidfile = _config['server-pid-file'], signal_map = { signal.SIGUSR1: 'terminate', signal.SIGHUP: configuration.reload, }, ) _log.debug('Entering running context...') with context: _log.info('Configuration file: {0}'.format(configuration.filename())) _log.info('Initializing ConSys server daemon...') from consys.common import app from consys.server import network, persistent, hw, connections, \ ampserver app.startup() app.dispatch_loop() _log.info('Terminating ConSys server daemon...') except Exception: _log.exception('Unhandled exception in main thread, exiting')