def stop_services(): for service in SUPERVISOR_SERVICES: proc = System.run_service_action('stop', service) proc.wait()
def start_services(): for service in SUPERVISOR_SERVICES: try: cmd_wait_output(System.run_service_action('start', service)) except Exception: logger.warning('Starting {} failed'.format(service))
def check_services(): for service in SUPERVISOR_SERVICES: status_output, _ = cmd_wait_output(System.run_service_action('status', service)) if 'no such process' in status_output.decode('utf-8').lower(): raise Exception('Could not find service "{}"'.format(service))