Files
knowledge-base/snippets/niikn-podkop/podkop-heal.sh

20 lines
846 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# podkop-heal.sh (NIIKN OpenWrt) — лечение залипа forward/tproxy sing-box.
# Чистый перезапуск podkop + сброс FakeIP-кэша + ОБЯЗАТЕЛЬНО dnsmasq restart (иначе старые FakeIP
# у dnsmasq/клиентов рассинхронятся — грабля 2026-06-29), затем re-probe. Лок от гонок.
LOCK=/tmp/.pkheal.lock
now=$(date +%s)
[ -f "$LOCK" ] && [ $((now - $(cat "$LOCK" 2>/dev/null || echo 0))) -lt 120 ] && exit 0
echo "$now" > "$LOCK"
logger -t podkop-heal "heal: podkop restart + cache flush + dnsmasq restart"
/etc/init.d/podkop stop 2>/dev/null
killall sing-box 2>/dev/null
rm -f /tmp/sing-box/cache.db
/etc/init.d/podkop start 2>/dev/null
sleep 12
/etc/init.d/dnsmasq restart 2>/dev/null
sleep 3
rm -f "$LOCK"
/usr/local/bin/podkop-probe.sh
exit $?