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)}