changeset 2140:bc999d5036fb nginx_decoupled

more robust stop_nginx.sh
author Violet7
date Mon, 19 Jan 2026 20:37:47 -0800
parents 68b055359b2b
children c62dfd37545f
files host/stop_nginx.sh
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/host/stop_nginx.sh	Mon Jan 19 20:29:52 2026 -0800
+++ b/host/stop_nginx.sh	Mon Jan 19 20:37:47 2026 -0800
@@ -1,13 +1,16 @@
 #!/bin/bash
 
 set -e
+# currently unused
 . nginx_common.sh
 
-NGINX_PID_FILE="$NGINX_PID_DIR/nginx.pid"
+PIDS=$(
+	ps -eo pid,comm,args |
+		awk '/nginx: master process/ {print $1}'
+)
 
-# if file exists and is non empty
-if [ -s "$NGINX_PID_FILE" ]; then
-	sudo nginx -c $NGINX_ROOT_CONFIG_FILE -s stop
+if [ -n "$PIDS" ]; then
+	kill -QUIT $PIDS
 else
-	echo "PID file empty or non existent, doing nothing."
+	echo "No nginx master process found, not attempting to stop."
 fi