watchdog.uc: - H-8: keepalive timestamp for init.d supervision - H-14: save config backup after successful start - M-1: empty_sections check domain/domain_suffix/ip_cidr - M-2: dns_loop re-enable cooldown (5 min) - M-11: reload_firewall always dedup - M-12: merge wan+gateway heal into one function - M-13: telegram rate limit (max 10 per 5 min) nft/apply.uc: background reload_firewall to avoid blocking subscription/cache.uc: write_text → write_text_if_changed (atomic) dns_prefetch.uc: blocking sleep 10 → poll with early exit diagnostics/runtime.uc: atomic uci_backup_save/restore, atomic scale writes, nslookup -port fix wan-monitor: rate limit notifications (60s cooldown)
25 lines
741 B
Bash
25 lines
741 B
Bash
#!/bin/sh
|
|
# Only process ifup and ifdown events for WAN interfaces
|
|
# Rate limit: max 1 notification per 60 seconds
|
|
COOLDOWN_FILE="/tmp/tachyon_wan_monitor_cooldown"
|
|
NOW=$(date +%s)
|
|
if [ -f "$COOLDOWN_FILE" ]; then
|
|
LAST=$(cat "$COOLDOWN_FILE" 2>/dev/null || echo 0)
|
|
DIFF=$((NOW - LAST))
|
|
[ "$DIFF" -lt 60 ] && exit 0
|
|
fi
|
|
echo "$NOW" > "$COOLDOWN_FILE"
|
|
|
|
case "$INTERFACE" in
|
|
wan*|wwan*|lte*)
|
|
case "$ACTION" in
|
|
ifup)
|
|
/usr/bin/tachyon telegram send "🟢 Интерфейс *${INTERFACE}* поднялся!"
|
|
;;
|
|
ifdown)
|
|
/usr/bin/tachyon telegram send "⚠️ Интерфейс *${INTERFACE}* упал!"
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|