Files
ulthon_admin/source/docker/run.sh
augushong ee900ffb8a fix(docker): 修复定时器进程因 www-data nologin shell 无法启动的问题
www-data 用户默认 shell 为 /usr/sbin/nologin,导致 su - www-data -c 被拒绝,
定时器从未启动,主机节点心跳不上报。改用 su -s /bin/bash 指定 shell,
并将定时器日志输出到 runtime/timer.log 方便排查。
2026-05-26 20:45:52 +08:00

38 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 将代码中的nginx复制到nginx配置文件中
cp /var/www/html/source/docker/nginx.conf /etc/nginx/sites-available/default
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# 将代码中的php配置文件复制到php配置文件中
cp /var/www/html/source/docker/zz-phprun.ini /usr/local/etc/php/conf.d
cp /var/www/html/source/docker/zz-phpfpm.conf /usr/local/etc/php-fpm.d
# 设置目录权限,确保挂载卷后依然有效
mkdir -p /var/www/html/runtime && chmod -R 777 /var/www/html/runtime
mkdir -p /var/www/html/public/storage && chmod -R 777 /var/www/html/public/storage
mkdir -p /var/www/html/public/build && chmod -R 777 /var/www/html/public/build
mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 运行redis
# nohup redis-server --requirepass "" &
# 输出参数
echo "参数为:$@"
# TODO增加自动批量运行并阻塞的脚本比如group default 会调用auto.sh的default的部分最终阻塞auth.sh的default部分可能会运行一系列的命令比如清空缓存踢人下线重置密码
if [ "$1" = "server" ] || [ "$1" = "" ]; then
# 运行定时任务 TODO:以指定用户运行
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
php-fpm
else
php "/var/www/html/""$@"
fi