#!/bin/bash # 查为什么首页还是 no-store,尽管代码里有 max-age=60 set -u echo "════════ 1. 进程状态 ════════" systemctl show lanremote-relay -p ActiveEnterTimestamp -p MainPID --value | sed 's/^/ /' echo " 现在: $(date '+%Y-%m-%d %H:%M:%S')" echo " 进程命令行:" ps -o pid,etime,cmd -p $(systemctl show lanremote-relay -p MainPID --value) 2>/dev/null | sed 's/^/ /' echo echo "════════ 2. 本地首页响应头(全部)════════" curl -sI --max-time 15 http://127.0.0.1:8080/ 2>/dev/null | tr -d '\r' | sed 's/^/ /' echo echo "════════ 3. 换个端口直接跑这份代码,排除服务读的是别的文件 ════════" cd /root/lanremote-relay RELAY_PORT=18099 RELAY_BIND=127.0.0.1 timeout 8 python3 relay.py > /tmp/fresh.log 2>&1 & sleep 4 echo " 新进程的首页头:" curl -sI --max-time 6 http://127.0.0.1:18099/ 2>/dev/null | tr -d '\r' | grep -iE '^cache-control|^HTTP' | sed 's/^/ /' wait 2>/dev/null || true echo echo "════════ 4. 服务实际读的文件是哪个 ════════" systemctl cat lanremote-relay 2>/dev/null | grep -E 'WorkingDirectory|ExecStart' | sed 's/^/ /' echo " WorkingDirectory 下的 relay.py md5: $(md5sum /root/lanremote-relay/relay.py 2>/dev/null | awk '{print $1}')" echo echo "════════ 5. 有没有 __pycache__ 里的旧字节码在捣乱 ════════" ls -la /root/lanremote-relay/__pycache__/ 2>/dev/null | sed 's/^/ /' || echo " (没有 __pycache__)" echo echo "════════ 6. 源码里那段到底长什么样(带行号)════════" grep -n -B3 -A6 'max-age=60' /root/lanremote-relay/relay.py | sed 's/^/ /'