Exemplo n.º 1
0
            # => send email that communication problems are solved
            if not globalData.smtpAlert is None:
                globalData.smtpAlert.sendCommunicationAlertClear()

            connectionRetries = 1
            break
        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()

    # start data collector thread
    dataCollector = LightningmapDataCollector(globalData.sensors)
    # set thread to daemon
    # => threads terminates when main thread terminates
    dataCollector.daemon = True
    dataCollector.start()

    # only start update checker if it is activated
    if updateActivated is True:
Exemplo n.º 2
0
			server = ThreadedTCPServer(globalData, ('0.0.0.0', port),
				ServerSession)
			break
		except Exception as e:
			logging.exception("[%s]: Starting server failed. " % fileName
			+ "Try again in 5 seconds.")
			time.sleep(5)

	serverThread = threading.Thread(target=server.serve_forever)
	# set thread to daemon
	# => threads terminates when main thread terminates	
	serverThread.daemon =True
	serverThread.start()

	# start a watchdog thread that controls all server sessions
	watchdog = ConnectionWatchdog(globalData, globalData.connectionTimeout)
	# set thread to daemon
	# => threads terminates when main thread terminates	
	watchdog.daemon = True
	watchdog.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()

	logging.info("[%s] server started." % fileName)
Exemplo n.º 3
0
			# if smtp alert is activated
			# => send email that communication problems are solved
			if not globalData.smtpAlert is None:
				globalData.smtpAlert.sendCommunicationAlertClear()
			
			connectionRetries = 1
			break
		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()

	# start data collector thread
	dataCollector = LightningmapDataCollector(globalData.sensors)
	# set thread to daemon
	# => threads terminates when main thread terminates
	dataCollector.daemon = True
	dataCollector.start()

	# only start update checker if it is activated
	if updateActivated is True:
		updateChecker = UpdateChecker(updateServer, updatePort, updateLocation,
Exemplo n.º 4
0
            globalData.logger.exception(
                "[%s]: Starting server failed. Try again in 5 seconds." %
                fileName)
            time.sleep(5)

    globalData.logger.info("[%s] Starting server thread." % fileName)
    serverThread = threading.Thread(target=server.serve_forever)
    # set thread to daemon
    # => threads terminates when main thread terminates
    serverThread.daemon = True
    serverThread.start()

    # start a watchdog thread that controls all server sessions
    globalData.logger.info("[%s] Starting connection watchdog thread." %
                           fileName)
    globalData.connectionWatchdog = ConnectionWatchdog(
        globalData, globalData.connectionTimeout)
    # set thread to daemon
    # => threads terminates when main thread terminates
    globalData.connectionWatchdog.daemon = True
    globalData.connectionWatchdog.start()

    # Start a watchdog thread that checks all configuration files.
    globalData.logger.info("[%s] Starting config watchdog thread." % fileName)
    globalData.configWatchdog = CSVWatchdog(globalData,
                                            globalData.configCheckInterval)
    # set thread to daemon
    # => threads terminates when main thread terminates
    globalData.configWatchdog.daemon = True
    globalData.configWatchdog.start()

    # only start survey executer if user wants to participate