diff --git a/rootfs/usr/local/bin/start-runners b/rootfs/usr/local/bin/start-runners index 0181f10..4a0aef1 100755 --- a/rootfs/usr/local/bin/start-runners +++ b/rootfs/usr/local/bin/start-runners @@ -3,7 +3,7 @@ set -e # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Function to __log messages with timestamp -__log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"; } +__log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >"$RUNNERS_LOG_DIR/runners" 2>&1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Function to cleanup child processes on exit __cleanup() { @@ -74,8 +74,15 @@ for i in $(seq 1 $RUNNERS_COUNT); do done unset i # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__log "All $RUNNERS_COUNT runners started successfully" -__log "Process IDs: $(jobs -p | tr '\n' ' ')" +RUNNERS_ID="$(jobs -p | tr '\n' ' ')" +if [ -n "$RUNNERS_ID" ]; then + __log "All $RUNNERS_COUNT runners started successfully" + __log "Process IDs: $RUNNERS_ID" + printf 'All %s runners started successfully: %s\n' "$RUNNERS_COUNT" "$RUNNERS_ID" +else + __log "The runners have failed to start" + printf '%s\n' "The runners have failed to start" +fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Wait for all background processes wait diff --git a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh index 0158a32..4b9916c 100755 --- a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh @@ -362,7 +362,7 @@ __post_execute() { local postMessageST="Running post commands for $SERVICE_NAME" # message to show at start local postMessageEnd="Finished post commands for $SERVICE_NAME" # message to show at completion local sysname="${SERVER_NAME:-${FULL_DOMAIN_NAME:-$HOSTNAME}}" # set hostname - export SERVER_ADDRESS="$RUNNER_IP_ADDRESS:$GITEA_PORT" SERVER_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}" RUNNERS_ENABLE="${RUNNERS_START:-5}" RUNNER_LABELS + export SERVER_ADDRESS="$RUNNER_IP_ADDRESS:$GITEA_PORT" SERVER_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}" RUNNERS_ENABLE="${RUNNERS_START:-5}" RUNNER_LABELS RUNNERS_LOG_DIR="$LOG_DIR" # wait sleep $waitTime # execute commands