Example #1
0
 def _shutdown(self, timeout=5):
     pid = self.getPid()
     if pid:
         os.kill(pid, signal.SIGTERM)
         sleepCount = timeout
         while isPidAlive(pid) and sleepCount > 0:
             time.sleep(1)
             sleepCount = sleepCount-1
         if isPidAlive(pid):
             raise Exception("Could not shut down device {}. (pid={})".format(self.name(), pid))
     for file in self._getDeviceRunFiles():
         if os.path.exists(file):
             os.unlink(file)
Example #2
0
 def _running(self):
     for requiredFile in self._getDeviceRunFiles():
         if not os.path.exists(requiredFile):
             return False
     pid = self.getPid()
     return pid and isPidAlive(pid)