# State tracking to avoid spam
mkdir -p "$(dirname "$STATE_FILE")"
LAST_NOTIFIED=$(cat"$STATE_FILE" 2>/dev/null || echo"0")
NOW=$(date +%s)
# Only notify once per hour max
MIN_INTERVAL=3600
send_notification() {
local message="$1"
local priority="${2:-default}"
echo"$(date '+%Y-%m-%d %H:%M:%S') - $message"
# Check if we notified recently if [ $((NOW - LAST_NOTIFIED)) -lt $MIN_INTERVAL ]; then echo"Skipping notification (sent recently)"
return fi
# Send via OpenClaw if phone configured and auth still valid if [ -n "$NOTIFY_PHONE" ]; then # Check if we can still use openclaw if"$SCRIPT_DIR/claude-auth-status.sh" simple 2>/dev/null | grep -q "OK\|EXPIRING"; then echo"Sending via OpenClaw to $NOTIFY_PHONE..."
openclaw send --to "$NOTIFY_PHONE" --message "$message" 2>/dev/null || true fi fi
# Send via ntfy.sh if configured if [ -n "$NOTIFY_NTFY" ]; then echo"Sending via ntfy.sh to $NOTIFY_NTFY..."
curl -s -o /dev/null \
-H "Title: OpenClaw Auth Alert" \
-H "Priority: $priority" \
-H "Tags: warning,key" \
-d "$message" \ "https://ntfy.sh/$NOTIFY_NTFY" || true fi
# Update state echo"$NOW" > "$STATE_FILE"
}
# Check auth status if [ ! -f "$CLAUDE_CREDS" ]; then
send_notification "Claude Code credentials missing! Run: claude setup-token""high"
exit 1 fi
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.