From 84d16c1c12886d9382b3a2148c2e8ccc13758c83 Mon Sep 17 00:00:00 2001 From: Callum Tait <15716903+toast-gear@users.noreply.github.com> Date: Thu, 23 Jun 2022 12:39:32 +0100 Subject: [PATCH] revert: "Overhauled `startup.sh` Script (#1454)" (#1561) This reverts commit 071898c96bcfb482730290293dc591e010ec7595. --- runner/startup.sh | 119 ++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 62 deletions(-) diff --git a/runner/startup.sh b/runner/startup.sh index dd287f8a..6352a0d5 100755 --- a/runner/startup.sh +++ b/runner/startup.sh @@ -1,75 +1,70 @@ -#!/usr/bin/env bash -set -Eeuo pipefail +#!/bin/bash +source logger.bash -# This path can only be customized through arguments passed to the dockerd cli -# at startup. Parsing the supervisor docker.conf file is cumbersome, and there -# is little reason to allow users to customize this. Hence, we hardcode the path -# here. -# -# See: https://docs.docker.com/engine/reference/commandline/dockerd/ -readonly dockerd_config_path=/etc/docker/daemon.json -readonly dockerd_supervisor_config_path=/etc/supervisor/conf.d/dockerd.conf +function wait_for_process () { + local max_time_wait=30 + local process_name="$1" + local waited_sec=0 + while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do + log.debug "Process $process_name is not running yet. Retrying in 1 seconds" + log.debug "Waited $waited_sec seconds of $max_time_wait seconds" + sleep 1 + ((waited_sec=waited_sec+1)) + if ((waited_sec >= max_time_wait)); then + return 1 + fi + done + return 0 +} -# Extend existing config... -dockerd_config=$(! cat $dockerd_config_path 2>&-) +sudo /bin/bash <