From 0c399b015694eaf7c7497ae418a72f5dbcfa0468 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sun, 28 Jul 2024 12:39:24 +0200 Subject: [PATCH] add running check to update script --- run-wrapper/update | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/run-wrapper/update b/run-wrapper/update index 28041ba9..12ba0d60 100755 --- a/run-wrapper/update +++ b/run-wrapper/update @@ -5,6 +5,15 @@ set -o pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +PIDFILE="$SCRIPT_DIR"/.pid + +if [ -f "$PIDFILE" ]; then + if kill -0 $(cat "$PIDFILE") >/dev/null; then + echo "Already running: "$(cat "$PIDFILE") + exit 2 + fi +fi + # 💀 LATEST=$(curl "https://api.github.com/repos/usatiuk/dhfs/actions/runs?branch=main&status=completed&per_page=1" | tr -d "[:space:]" | sed -n "s/.*\[{\"id\":\([0-9]*\).*/\1/p")