git: 0b52e70543a4 - main - sysutils/nginx-ui: Add workaround for stale UNIX socket

From: Jesús Daniel Colmenares Oviedo <dtxdf_at_FreeBSD.org>
Date: Fri, 12 Sep 2025 06:34:33 UTC
The branch main has been updated by dtxdf:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0b52e70543a4d591742f976f82ad8b5bdd0992e7

commit 0b52e70543a4d591742f976f82ad8b5bdd0992e7
Author:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
AuthorDate: 2025-09-12 06:29:56 +0000
Commit:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
CommitDate: 2025-09-12 06:33:35 +0000

    sysutils/nginx-ui: Add workaround for stale UNIX socket
    
    If, for example, there is a power failure, the UNIX socket file will
    be left and the error "connect: connection refused" will be displayed,
    so the best thing to do is to delete it before starting NGINX UI.
---
 sysutils/nginx-ui/Makefile          | 2 +-
 sysutils/nginx-ui/files/nginx-ui.in | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sysutils/nginx-ui/Makefile b/sysutils/nginx-ui/Makefile
index f1622f0f2f28..06299629b75b 100644
--- a/sysutils/nginx-ui/Makefile
+++ b/sysutils/nginx-ui/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	nginx-ui
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.1.17
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils
 MASTER_SITES=	LOCAL/dtxdf/${PORTNAME}/
 DISTFILES=	${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}.frontend${EXTRACT_SUFX} \
diff --git a/sysutils/nginx-ui/files/nginx-ui.in b/sysutils/nginx-ui/files/nginx-ui.in
index 775365e846d0..25ab52c8bd44 100644
--- a/sysutils/nginx-ui/files/nginx-ui.in
+++ b/sysutils/nginx-ui/files/nginx-ui.in
@@ -28,5 +28,9 @@ pidfile="/var/run/nginx-ui.pid"
 procname="%%LOCALBASE%%/bin/nginx-ui"
 command="/usr/sbin/daemon"
 command_args="-o ${nginx_ui_log} -u ${nginx_ui_runas} -p ${pidfile} -t \"${desc}\" ${procname}"
+# If, for example, there is a power failure, the UNIX socket file will be left and
+# the error "connect: connection refused" will be displayed, so the best thing to
+# do is to delete it before starting NGINX UI.
+start_precmd="rm -f /var/db/nginx-ui/nginx-ui.sock"
 
 run_rc_command "$1"