Files
nas-tools/notify.sh
T
Gan, Jimmy 64ecd99dc7 Add OpenClaw, backup automation, health checks, Telegram notifications
Phase 6: OpenClaw docker-compose (port 3100) with health check
Phase 9: Enhanced backup.sh with full DB/config coverage + Telegram alerts
Phase 10: Health checks on all compose files, /api/system/notify endpoint
2026-02-19 21:40:34 +08:00

19 lines
621 B
Bash
Executable File

#!/bin/bash
# notify.sh — Send Telegram notification
# Usage: ./notify.sh "message text"
# Requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID env vars (or source from .env)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
[ -f "$SCRIPT_DIR/.env" ] && source "$SCRIPT_DIR/.env"
if [ -z "$TELEGRAM_BOT_TOKEN" ] || [ -z "$TELEGRAM_CHAT_ID" ]; then
echo "TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID required"
exit 1
fi
MSG="${1:-No message}"
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="$TELEGRAM_CHAT_ID" \
-d text="$MSG" \
-d parse_mode="Markdown" > /dev/null