finished actions => handlers refacto, small bux fix in maestro => Test maestro1 OK

This commit is contained in:
STEINNI
2026-06-20 20:10:14 +00:00
parent 44a84c64ec
commit 3066a54a4c
32 changed files with 386 additions and 33 deletions
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
GOD_FOLDERS="Maestro GPS Observer"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/resolveConfigPath.sh
. "$ROOT/lib/resolveConfigPath.sh"
CONFIG="config.json"
usage() {
echo "Usage: $(basename "$0") [-c|--config PATH]" >&2
echo " PATH is relative to $ROOT unless absolute." >&2
}
while [ $# -gt 0 ]; do
case "$1" in
-c|--config)
if [ -z "${2:-}" ]; then
echo "Missing value for $1" >&2
usage
exit 1
fi
CONFIG="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
CONFIG="$1"
shift
;;
esac
done
CONFIG="$(resolveConfigPath "$ROOT" "$CONFIG")"
if [ ! -f "$CONFIG" ]; then
echo "Config file not found: $CONFIG" >&2
exit 1
fi
failed=0
for folder in $GOD_FOLDERS; do
dir="$ROOT/$folder"
if [ ! -d "$dir" ]; then
echo "Missing daemon folder: $dir" >&2
failed=1
continue
fi
shopt -s nullglob
scripts=("$dir"/start*.sh)
shopt -u nullglob
if [ ${#scripts[@]} -eq 0 ]; then
echo "No start script in $dir" >&2
failed=1
continue
fi
if [ ${#scripts[@]} -gt 1 ]; then
echo "Multiple start scripts in $dir, using ${scripts[0]}" >&2
fi
echo "=== Starting $folder (config=$CONFIG) ==="
(cd "$dir" && bash "${scripts[0]}" "$CONFIG") || {
echo "Failed to start $folder" >&2
failed=1
}
done
exit $failed