def shutdownMachine(self, waitSeconds=3): self._isShutdownTriggered = True if self._controlPipe: try: self._controlPipe.executeRpc("shutdownTriggered", True) except Exception as err: # pylint: disable=broad-except logger.debug(err) self.clearShutdownRequest() System.shutdown(wait=waitSeconds)
def run(self): while True: try: System.shutdown(0) logger.notice("Shutdown initiated") break except Exception as err: # pylint: disable=broad-except # Device not ready? logger.info("Failed to initiate shutdown: %s", err) time.sleep(1)