#!/usr/bin/env bash # openclaw-watchdog installer (Krilly's fork — Telegram + ntfy edition) # https://github.com/jlgrimes/openclaw-watchdog set -euo pipefail INSTALL_DIR="$HOME/.openclaw" SERVICE_NAME="openclaw-watchdog" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "🦞 OpenClaw Watchdog — Installer (Krilly's Telegram/ntfy Edition)" echo "───────────────────────────────────────────────────────────────────" # Ensure install dir exists mkdir -p "$INSTALL_DIR" # Copy watchdog script cp "$SCRIPT_DIR/watchdog.sh" "$INSTALL_DIR/watchdog.sh" chmod +x "$INSTALL_DIR/watchdog.sh" echo "✅ Installed watchdog.sh → $INSTALL_DIR/watchdog.sh" # Prompt for Telegram bot token TELEGRAM_BOT_TOKEN="" read -rp "Telegram Bot Token (leave blank to skip): " TELEGRAM_BOT_TOKEN # Prompt for ntfy topic NTFY_URL="https://ntfy.sh" read -rp "ntfy Server URL [$NTFY_URL]: " custom_ntfy [[ -n "$custom_ntfy" ]] && NTFY_URL="$custom_ntfy" NTFY_TOPIC="" read -rp "ntfy Topic (leave blank to skip): " NTFY_TOPIC NTFY_MIN_PRIORITY="4" read -rp "ntfy Min Priority [$NTFY_MIN_PRIORITY]: " custom_prio [[ -n "$custom_prio" ]] && NTFY_MIN_PRIORITY="$custom_prio" # Create env file ENV_FILE="$INSTALL_DIR/watchdog.env" cat > "$ENV_FILE" </dev/null <