дебаг: добавлена отладка для автоопределения VPS (v1.0.7)
This commit is contained in:
parent
9abaafdb77
commit
7b8bd4aa24
3
rproxy
3
rproxy
|
|
@ -298,11 +298,13 @@ show_status() {
|
||||||
|
|
||||||
find_vps_by_domain() {
|
find_vps_by_domain() {
|
||||||
local dom="$1"
|
local dom="$1"
|
||||||
|
msg "Отладка: Резолвлю $dom..." >&2
|
||||||
# Пытаемся получить IP через ping (BusyBox стиль)
|
# Пытаемся получить IP через ping (BusyBox стиль)
|
||||||
local ip=$(ping -c 1 "$dom" 2>/dev/null | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | head -n 1)
|
local ip=$(ping -c 1 "$dom" 2>/dev/null | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | head -n 1)
|
||||||
# Если не вышло, пробуем nslookup (парсим более надежно через grep -o)
|
# Если не вышло, пробуем nslookup (парсим более надежно через grep -o)
|
||||||
[ -z "$ip" ] && ip=$(nslookup "$dom" 2>/dev/null | grep "Address" | tail -n 1 | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | head -n 1)
|
[ -z "$ip" ] && ip=$(nslookup "$dom" 2>/dev/null | grep "Address" | tail -n 1 | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | head -n 1)
|
||||||
|
|
||||||
|
msg "Отладка: Получен IP: '$ip'" >&2
|
||||||
[ -z "$ip" ] && return 1
|
[ -z "$ip" ] && return 1
|
||||||
|
|
||||||
for f in "$VPS_DIR"/*.conf; do
|
for f in "$VPS_DIR"/*.conf; do
|
||||||
|
|
@ -310,6 +312,7 @@ find_vps_by_domain() {
|
||||||
(
|
(
|
||||||
VPS_HOST=""
|
VPS_HOST=""
|
||||||
. "$f"
|
. "$f"
|
||||||
|
msg "Отладка: Сравниваю с VPS '$(basename "$f" .conf)' (HOST: $VPS_HOST)" >&2
|
||||||
if [ "$VPS_HOST" = "$ip" ]; then
|
if [ "$VPS_HOST" = "$ip" ]; then
|
||||||
basename "$f" .conf
|
basename "$f" .conf
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue