feat(openclaw): add setup-dashboards-cron.sh and update knowledge-wiki submodule

This commit is contained in:
Moritz Graf
2026-10-11 22:25:46 +02:00
parent 6b3b024726
commit 692bcc2084
2 changed files with 41 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# ==============================================================================
# setup-dashboards-cron.sh
# Declaratively registers periodic background publishing for Mila & Moritz dashboards in OpenClaw.
# Schedule: Every 10 minutes (pure shell command execution, zero LLM token cost)
# ==============================================================================
set -euo pipefail
NAMESPACE="${NAMESPACE:-openclaw}"
POD_NAME="${POD_NAME:-openclaw-0}"
CONTAINER_NAME="${CONTAINER_NAME:-openclaw}"
JOB_NAME="dashboards-periodic-publish"
SCHEDULE_EVERY="10m"
echo "=== Registering Dashboards Periodic Publish in OpenClaw ($POD_NAME) ==="
# 1. Check if job already exists
EXISTING_ID=$(kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron list --json 2>/dev/null | python3 -c 'import sys, json; data=json.load(sys.stdin); print(next((j["id"] for j in data.get("jobs", []) if j.get("declarationKey") == "'"$JOB_NAME"'" or j.get("name") == "'"$JOB_NAME"'"), ""))' 2>/dev/null || true)
if [ -n "$EXISTING_ID" ]; then
echo "Found existing job with ID $EXISTING_ID. Removing for idempotent recreation..."
kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron rm "$EXISTING_ID" || true
fi
# 2. Add the job as direct shell command execution with --no-deliver
echo "Creating automation $JOB_NAME (every $SCHEDULE_EVERY)..."
CMD="sh -lc 'cd /home/node/mop-skills/mop-skills/skills/datastore && uv run scripts/update_website.py --data-dir /home/node/.openclaw/wiki/main/data && uv run scripts/update_moritz_website.py --data-dir /home/node/.openclaw/wiki/main/data'"
kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron add \
--name "$JOB_NAME" \
--description "Periodically regenerates and uploads Mila & Moritz family HTML dashboards to S3" \
--command "$CMD" \
--every "$SCHEDULE_EVERY" \
--no-deliver
echo "=== Automation successfully registered! ==="
kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER_NAME" -- openclaw cron list | grep "$JOB_NAME" || true