Files
2026-07-05 14:43:34 +08:00

23 lines
1.1 KiB
Bash

#!/bin/bash
echo "--- All nginx/openresty processes ---"
ps -efL | grep -E "nginx|openresty" | grep -v grep
echo "--- Find s6 control files for nginx ---"
ls -la /etc/s6-overlay/s6-rc.d/ 2>/dev/null | head -20
ls -la /run/service/ 2>/dev/null | head -10
ls -la /etc/services.d/ 2>/dev/null | head -10
find / -name "nginx" -type d 2>/dev/null | head -5
echo "--- Find s6 finish / down files ---"
find /etc/s6-overlay /etc/services.d /run/service -name "finish" -o -name "down" 2>/dev/null | head -10
echo "--- Try s6-svc or svc to restart ---"
which s6-svc 2>&1
which s6-rc 2>&1
echo "--- kill master brutally, s6 should restart ---"
NGINX_MASTER=$(ps -efL | grep "nginx: master" | grep -v grep | awk '{print $2}' | head -1)
echo "Old master: $NGINX_MASTER"
kill -9 "$NGINX_MASTER" 2>&1
sleep 5
ps -efL | grep -E "nginx" | grep -v grep
echo "--- Test 80 after restart ---"
curl -o /dev/null -s -w "API: HTTP %{http_code}\n" http://localhost/api/v1/banners
curl -o /dev/null -s -w "Uploads: HTTP %{http_code} size=%{size_download}\n" http://localhost/uploads/1781403331659-1cac3cac.png