29 lines
1005 B
Bash
29 lines
1005 B
Bash
#!/bin/bash
|
|
# 部署卡顿修复并验证 rt=
|
|
set -e
|
|
DJANGO_DIR="/opt/1panel/apps/openresty/nginx/www/sites/43.142.166.152.443/django"
|
|
NGINX_LOG="/opt/1panel/apps/openresty/nginx/log/access.log"
|
|
cd "$DJANGO_DIR"
|
|
|
|
echo ">>> git pull"
|
|
git pull origin main
|
|
|
|
echo ">>> 更新 systemd (6 workers)"
|
|
cp deploy/systemd/gunicorn-dianjing.service /etc/systemd/system/gunicorn-dianjing.service
|
|
systemctl daemon-reload
|
|
systemctl restart gunicorn-dianjing.service
|
|
sleep 2
|
|
systemctl is-active gunicorn-dianjing.service
|
|
pgrep -cf 'gunicorn.*a_long_dianjing' || true
|
|
|
|
echo ""
|
|
echo ">>> 最近慢请求 (rt>=0.5s):"
|
|
grep -a 'hqhd' "$NGINX_LOG" | awk 'match($0,/rt=([0-9.]+)/,a){if(a[1]+0>=0.5)print}' | tail -5
|
|
|
|
echo ""
|
|
echo ">>> 最近 dddhq / merchant-staff/me:"
|
|
grep -a 'hqhd' "$NGINX_LOG" | grep -E 'ddhq|merchant-staff/me' | tail -8 | awk 'match($0,/rt=([0-9.]+)/,a){rt=a[1]} match($0,/POST ([^ ]+)/,b){print " rt="rt"s "b[1]}'
|
|
|
|
echo ""
|
|
echo "部署完成。请用手机再试,然后看上面 rt 是否都 <0.2s"
|