From c5409ad902ec028edc85bf57921e189365735321 Mon Sep 17 00:00:00 2001 From: Stephan Barth Date: Mon, 7 Oct 2024 14:40:44 +0200 Subject: [PATCH] build(utils/watchrun.sh): File watcher for running commands. --- utils/watchrun.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 utils/watchrun.sh diff --git a/utils/watchrun.sh b/utils/watchrun.sh new file mode 100755 index 000000000..bd3d7fbc4 --- /dev/null +++ b/utils/watchrun.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +FILENAME=$1 +STARTSCRIPT=$2 +STOPSCRIPT=$3 + +touch "$FILENAME" + +$STARTSCRIPT & + +while [ -e "$FILENAME" ] ; do + inotifywait -e ATTRIB -t 10 "$FILENAME" > /dev/null 2&>/dev/null +done + +kill %1 + +$STOPSCRIPT +