diff --git a/runner/startup.sh b/runner/startup.sh index dd287f8a36..6352a0d5f3 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 <