- add the per-run ATVM watcher service package under atvm/watcher-service, including the Python watcher, systemd template unit, helper scripts, and deployment docs - document the watcher-service install and operating model, including one-run-per-instance behavior, Mattermost posting rules, and the best-practice /opt/atvm-watcher-service install path - clarify ATVM run approval semantics so `approve` means run without watcher and `approve with watcher` means run and start the watcher - update the ATVM automation guide and AGENTS rules so watcher usage and approval behavior are explicit and consistent
33 lines
701 B
Bash
33 lines
701 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
cancel-atvm-run-watcher.sh --build-name <name> [--state-root <path>]
|
|
EOF
|
|
}
|
|
|
|
BUILD_NAME=""
|
|
STATE_ROOT="/var/lib/atvm-run-watcher"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--build-name) BUILD_NAME="${2:-}"; shift 2 ;;
|
|
--state-root) STATE_ROOT="${2:-}"; shift 2 ;;
|
|
-h|--help) usage; exit 0 ;;
|
|
*) echo "Unknown argument: $1" >&2; usage >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$BUILD_NAME" ]]; then
|
|
echo "--build-name is required" >&2
|
|
usage >&2
|
|
exit 1
|
|
fi
|
|
|
|
RUN_DIR="${STATE_ROOT}/${BUILD_NAME}"
|
|
mkdir -p "$RUN_DIR"
|
|
touch "${RUN_DIR}/cancelled.marker"
|
|
systemctl stop "atvm-run-watcher@${BUILD_NAME}.service" || true
|