fix: restore minimal long-task watchdog execution chain
This commit is contained in:
18
scripts/install_long_task_watchdog_cron.sh
Executable file
18
scripts/install_long_task_watchdog_cron.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CRON_FILE="$ROOT_DIR/state/cron/long-task-watchdog.cron"
|
||||
LOG_DIR="$ROOT_DIR/state/long-task-watchdog"
|
||||
RUNNER="$ROOT_DIR/scripts/long_task_watchdog.mjs"
|
||||
STATE_FILE="$ROOT_DIR/memory/watchdog-state.json"
|
||||
|
||||
mkdir -p "$(dirname "$CRON_FILE")" "$LOG_DIR"
|
||||
|
||||
cat >"$CRON_FILE" <<EOF
|
||||
*/10 * * * * cd "$ROOT_DIR" && /usr/bin/env node "$RUNNER" --write-state --state "$STATE_FILE" --evidence-dir "$LOG_DIR" >> "$LOG_DIR/cron.log" 2>&1
|
||||
EOF
|
||||
|
||||
printf 'Wrote cron snippet: %s\n' "$CRON_FILE"
|
||||
printf 'To install for current user, run:\n'
|
||||
printf ' (crontab -l 2>/dev/null; cat "%s") | crontab -\n' "$CRON_FILE"
|
||||
Reference in New Issue
Block a user