Files
yuyueguahao/scripts/check-nginx.sh
T
2026-07-05 14:43:34 +08:00

18 lines
704 B
Bash

#!/bin/bash
echo "--- Check nginx processes ---"
ps -efL | grep -E "nginx|openresty" | grep -v grep
echo "--- Sleep 3s, then check again ---"
sleep 3
ps -efL | grep -E "nginx" | grep -v grep | head -5
echo "--- Find master ---"
NGINX_MASTER=$(ps -efL | grep "nginx: master" | grep -v grep | awk '{print $2}' | head -1)
echo "Master PID: $NGINX_MASTER"
if [ -n "$NGINX_MASTER" ]; then
kill -HUP "$NGINX_MASTER"
sleep 2
echo "--- TEST uploads ---"
curl -o /dev/null -s -w "HTTP %{http_code} size=%{size_download} type=%{content_type}\n" http://localhost/uploads/1781403331659-1cac3cac.png
echo "--- TEST api ---"
curl -o /dev/null -s -w "HTTP %{http_code}\n" http://localhost/api/v1/banners
fi