Ejemplo n.º 1
0
    def StartThreads(self, reload=False):

        try:
            # start thread to accept incoming sockets for nagios heartbeat
            self.Threads["ComWatchDog"] = mythread.MyThread(self.ComWatchDog,
                                                            Name="ComWatchDog")

            if self.bSyncDST or self.bSyncTime:  # Sync time thread
                self.Threads["TimeSyncThread"] = mythread.MyThread(
                    self.TimeSyncThread, Name="TimeSyncThread")

            if not self.DisableWeather and not self.WeatherAPIKey == None and len(
                    self.WeatherAPIKey
            ) and not self.WeatherLocation == None and len(
                    self.WeatherLocation):
                Unit = 'metric' if self.UseMetric else 'imperial'
                self.MyWeather = myweather.MyWeather(
                    self.WeatherAPIKey,
                    location=self.WeatherLocation,
                    unit=Unit,
                    log=self.log)
                self.Threads = self.MergeDicts(self.Threads,
                                               self.MyWeather.Threads)
        except Exception as e1:
            self.LogErrorLine("Error in StartThreads: " + str(e1))
Ejemplo n.º 2
0
    def StartThreads(self, reload=False):

        # start thread to accept incoming sockets for nagios heartbeat and command / status clients
        self.Threads["InterfaceServerThread"] = mythread.MyThread(
            self.InterfaceServerThread, Name="InterfaceServerThread")

        # start thread to accept incoming sockets for nagios heartbeat
        self.Threads["ComWatchDog"] = mythread.MyThread(self.ComWatchDog,
                                                        Name="ComWatchDog")

        if self.bSyncDST or self.bSyncTime:  # Sync time thread
            self.Threads["TimeSyncThread"] = mythread.MyThread(
                self.TimeSyncThread, Name="TimeSyncThread")

        if not self.WeatherAPIKey == None and len(
                self.WeatherAPIKey
        ) and not self.WeatherLocation == None and len(self.WeatherLocation):
            Unit = 'metric' if self.UseMetric else 'imperial'
            self.MyWeather = myweather.MyWeather(self.WeatherAPIKey,
                                                 location=self.WeatherLocation,
                                                 unit=Unit,
                                                 log=self.log)
            self.Threads = self.MergeDicts(self.Threads,
                                           self.MyWeather.Threads)