From ee900ffb8a294fa6413576a20c760465dec22321 Mon Sep 17 00:00:00 2001 From: augushong Date: Tue, 26 May 2026 20:45:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=E4=BF=AE=E5=A4=8D=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E5=99=A8=E8=BF=9B=E7=A8=8B=E5=9B=A0=20www-data=20nolo?= =?UTF-8?q?gin=20shell=20=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit www-data 用户默认 shell 为 /usr/sbin/nologin,导致 su - www-data -c 被拒绝, 定时器从未启动,主机节点心跳不上报。改用 su -s /bin/bash 指定 shell, 并将定时器日志输出到 runtime/timer.log 方便排查。 --- source/docker/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/docker/run.sh b/source/docker/run.sh index 5ee4601..f211c90 100644 --- a/source/docker/run.sh +++ b/source/docker/run.sh @@ -27,7 +27,7 @@ echo "参数为:$@" if [ "$1" = "server" ] || [ "$1" = "" ]; then # 运行定时任务 TODO:以指定用户运行 - su - www-data -c "nohup php /var/www/html/think timer --local --quit &" + su -s /bin/bash www-data -c "nohup php /var/www/html/think timer --local --quit > /var/www/html/runtime/timer.log 2>&1 &" # 运行nginx service nginx start # 运行php-fpm