def watch_controller(): maxretry = 4 retry = 0 while retry < maxretry: controller_pid = get_command_output('ps aux | grep seafile-controller | grep -v grep || true').strip() garbage_collector_pid = get_command_output('ps aux | grep /scripts/gc.sh | grep -v grep || true').strip() if not controller_pid and not garbage_collector_pid: retry += 1 else: retry = 0 time.sleep(5) print('seafile controller exited unexpectedly.') sys.exit(1)
def wait_for_nginx(): while True: logdbg('waiting for nginx server to be ready') output = get_command_output('netstat -nltp') if ':80 ' in output: logdbg(output) logdbg('nginx is ready') return time.sleep(2)