def __init__(self): current_dir = os.path.dirname(os.path.abspath(__file__)) static_dir = os.path.join(current_dir, '..', 'static') log.info(current_dir) log.info(static_dir) self.config = { '/': {'tools.basic_auth.on': True, # 'tools.basic_auth.realm': 'CherryPy Restricted space. Hint[user:cherrypy & pass:cherrypy]', # 'tools.basic_auth.users': {'cherrypy':encrypt_pw('cherrypy')}, # 'tools.basic_auth.encrypt': encrypt_pw, 'tools.staticdir.root': static_dir}, '/static': {'tools.gzip.on': True, 'tools.staticdir.on': True, 'tools.staticdir.dir': ''}, '/static/css': {'tools.gzip.mime_types':['text/css'], 'tools.staticdir.dir': 'css'}, '/static/js': {'tools.gzip.mime_types': ['application/javascript'], 'tools.staticdir.dir': 'js'}, '/static/img': {'tools.staticdir.dir': 'images'}} self.rootServer = Receiver()
"Try again in 5 seconds.") print "Connecting to server failed. Try again in 5 seconds." time.sleep(5) # when connected => generate watchdog object to monitor the # server connection watchdog = ConnectionWatchdog(globalData.serverComm, globalData.pingInterval, globalData.smtpAlert) # set thread to daemon # => threads terminates when main thread terminates watchdog.daemon = True watchdog.start() # generate receiver to handle incoming data (for example status updates) receiver = Receiver(globalData.serverComm) # set thread to daemon # => threads terminates when main thread terminates receiver.daemon = True receiver.start() # only start update checker if it is activated if updateActivated is True: updateChecker = UpdateChecker(updateServer, updatePort, updateLocation, updateCaFile, updateInterval, updateEmailNotification, globalData) # set thread to daemon # => threads terminates when main thread terminates updateChecker.daemon = True updateChecker.start()
# when connected => generate watchdog object to monitor the # server connection logging.info("[%s] Starting watchdog thread." % fileName) watchdog = ConnectionWatchdog(globalData.serverComm, globalData.pingInterval, globalData.smtpAlert) # set thread to daemon # => threads terminates when main thread terminates watchdog.daemon = True watchdog.start() # initialize all alerts logging.info("[%s] Initializing alerts." % fileName) for alert in globalData.alerts: alert.initializeAlert() # only start update checker if it is activated if updateActivated is True: logging.info("[%s] Starting update check thread." % fileName) updateChecker = UpdateChecker(updateServer, updatePort, updateLocation, updateCaFile, updateInterval, updateEmailNotification, globalData) # set thread to daemon # => threads terminates when main thread terminates updateChecker.daemon = True updateChecker.start() logging.info("[%s] Client started." % fileName) # generate receiver to handle incoming data (for example status updates) receiver = Receiver(globalData.serverComm) receiver.run()
connectionRetries += 1 logging.critical("[%s]: Connecting to server failed. " % fileName + "Try again in 5 seconds.") time.sleep(5) # when connected => generate watchdog object to monitor the # server connection watchdog = ConnectionWatchdog(globalData.serverComm, globalData.pingInterval, globalData.smtpAlert) # set thread to daemon # => threads terminates when main thread terminates watchdog.daemon = True watchdog.start() # initialize all alerts for alert in globalData.alerts: alert.initializeAlert() # only start update checker if it is activated if updateActivated is True: updateChecker = UpdateChecker(updateServer, updatePort, updateLocation, updateCaFile, updateInterval, updateEmailNotification, globalData) # set thread to daemon # => threads terminates when main thread terminates updateChecker.daemon = True updateChecker.start() # generate receiver to handle incoming data (for example status updates) receiver = Receiver(globalData.serverComm) receiver.run()
globalData.smtpAlert.sendCommunicationAlertClear() connectionRetries = 1 break connectionRetries += 1 logging.critical("[%s]: Connecting to server failed. " % fileName + "Try again in 5 seconds.") print "Connecting to server failed. Try again in 5 seconds." time.sleep(5) # when connected => generate watchdog object to monitor the # server connection watchdog = ConnectionWatchdog(globalData.serverComm, globalData.pingInterval, globalData.smtpAlert) # set thread to daemon # => threads terminates when main thread terminates watchdog.daemon = True watchdog.start() # generate receiver to handle incoming data (for example status updates) receiver = Receiver(globalData.serverComm) # set thread to daemon # => threads terminates when main thread terminates receiver.daemon = True receiver.start() # generate the console object and start it # (does not return unless it is exited) globalData.console = Console(globalData) globalData.console.startConsole()