From 07c8321d678717f0d5918981a84e2754f3d44d80 Mon Sep 17 00:00:00 2001 From: casjay Date: Sun, 11 Aug 2024 15:02:38 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh --- rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 b53a207..ae2645b 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 @@ -261,11 +261,12 @@ EOF cp -Rf "$CONF_DIR/multi.yaml" "$RUNNER_HOME/$RUNNER_NAME.yaml" __replace "REPLACE_RUNNER_HOME" "$RUNNER_HOME" "$RUNNER_HOME/$RUNNER_NAME.yaml" act_runner register --config "$RUNNER_HOME/$RUNNER_NAME.yaml" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "http://$CONTAINER_IP4_ADDRESS:8000" --token "$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0 || exitStatus=1 - echo "$!" >"$RUN_DIR/act_runner.$RUNNER_NAME.pid" + exitStatus=$? if [ $exitStatus -eq 0 ]; then exitStatus=0 cp -Rf "$runner" "$RUNNER_HOME/$RUNNER_NAME.reg" chown -Rf "$SERVICE_USER":"$SERVICE_GROUP" "$RUNNER_HOME" + echo "$!" >"$RUN_DIR/act_runner.$RUNNER_NAME.pid" break else [ -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid" ] && rm -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid" @@ -364,9 +365,15 @@ __post_execute() { __banner "$postMessageST" # commands to execute for multi in "$CONF_DIR/multi"/*; do + unset pid is_running name name="$(basename "$multi")" if [ -f "$$multi/$name.yaml" ] && [ -f "$multi/runners" ]; then - act_runner daemon --config $multi/$name.yaml + act_runner daemon --config $multi/$name.yaml & + local pid=$! + sleep 5 && ps ax | awk '{print $1}' | grep -v grep | grep -q "$execPid$" && is_running="yes" + if [ "$is_running" = "yes" ]; then + echo "$pid" >"$RUN_DIR/act_runner.$name.pid" + fi fi done