From cc203297983bb6c9bf2ec8d2d2d3d66b6e501728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=80=D0=B5=D0=B2?= Date: Tue, 28 Apr 2026 10:22:19 +0300 Subject: [PATCH] fix: use start-stop-daemon for autossh background launch + add close button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace setsid/nohup with start-stop-daemon -S -b as primary daemon method (setsid fails silently when script runs inside curl|sh pipe) - Same fix in init.d S99hydra_tun start/restart cases - Add "✓ Готово" button to tunnel modal to close it after setup Co-Authored-By: Claude Sonnet 4.6 --- server/main.py | 15 ++++++++++++--- server/templates/index.html | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/main.py b/server/main.py index b198202..df173ce 100644 --- a/server/main.py +++ b/server/main.py @@ -445,9 +445,16 @@ chmod +x /opt/bin/hydra_tun cat > /opt/etc/init.d/S99hydra_tun <<'INITEOF' #!/bin/sh case "$1" in - start) killall -0 autossh 2>/dev/null || ( nohup /opt/bin/hydra_tun /dev/null 2>&1 & ) ;; + start) + killall -0 autossh 2>/dev/null && exit 0 + /opt/sbin/start-stop-daemon -S -b -x /opt/bin/hydra_tun 2>/dev/null || \ + ( nohup /opt/bin/hydra_tun /dev/null 2>&1 & ) + ;; stop) killall autossh 2>/dev/null ;; - restart) killall autossh 2>/dev/null; sleep 1; ( nohup /opt/bin/hydra_tun /dev/null 2>&1 & ) ;; + restart) killall autossh 2>/dev/null; sleep 1 + /opt/sbin/start-stop-daemon -S -b -x /opt/bin/hydra_tun 2>/dev/null || \ + ( nohup /opt/bin/hydra_tun /dev/null 2>&1 & ) + ;; esac INITEOF chmod +x /opt/etc/init.d/S99hydra_tun @@ -456,7 +463,9 @@ echo '[4/4] Запуск...' killall autossh 2>/dev/null || true sleep 1 rm -f /tmp/hydra_tun.log -if command -v setsid >/dev/null 2>&1; then +if /opt/sbin/start-stop-daemon -S -b -x /opt/bin/hydra_tun 2>/dev/null; then + : +elif command -v setsid >/dev/null 2>&1; then setsid /opt/bin/hydra_tun /dev/null 2>&1 & else ( nohup /opt/bin/hydra_tun /dev/null 2>&1 & ) diff --git a/server/templates/index.html b/server/templates/index.html index 6ea39e2..08b6a51 100644 --- a/server/templates/index.html +++ b/server/templates/index.html @@ -232,6 +232,7 @@ input[type=text]:focus,input[type=password]:focus{border-color:var(--accent)}
+