mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改 linux 启动文件逻辑
This commit is contained in:
parent
476d13b52c
commit
a440ca981a
|
@ -34,12 +34,7 @@ fi
|
||||||
|
|
||||||
command="$1"
|
command="$1"
|
||||||
|
|
||||||
if [[ $command == "reload" ]]; then
|
if [[ $command != "reload" ]]; then
|
||||||
mkdir -p /run/nginx
|
|
||||||
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
os_name=$(source /etc/os-release && echo "$ID")
|
os_name=$(source /etc/os-release && echo "$ID")
|
||||||
|
|
||||||
|
@ -67,6 +62,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
npm install -g pnpm@8.3.1 pm2 ts-node
|
npm install -g pnpm@8.3.1 pm2 ts-node
|
||||||
|
fi
|
||||||
|
|
||||||
export PYTHON_SHORT_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
export PYTHON_SHORT_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
||||||
export PNPM_HOME=${QL_DIR}/data/dep_cache/node
|
export PNPM_HOME=${QL_DIR}/data/dep_cache/node
|
||||||
|
@ -78,7 +74,9 @@ export NODE_PATH=/usr/local/bin:/usr/local/lib/node_modules:${PNPM_HOME}/global/
|
||||||
export PIP_CACHE_DIR=${PYTHON_HOME}/pip
|
export PIP_CACHE_DIR=${PYTHON_HOME}/pip
|
||||||
export PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages
|
export PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages
|
||||||
|
|
||||||
|
if [[ $command != "reload" ]]; then
|
||||||
pip3 install --prefix ${PYTHON_HOME} requests
|
pip3 install --prefix ${PYTHON_HOME} requests
|
||||||
|
fi
|
||||||
|
|
||||||
cd ${QL_DIR}
|
cd ${QL_DIR}
|
||||||
cp -f .env.example .env
|
cp -f .env.example .env
|
||||||
|
@ -107,9 +105,10 @@ pm2 l &>/dev/null
|
||||||
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
||||||
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
||||||
|
|
||||||
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务...\n"
|
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务..."
|
||||||
reload_pm2
|
reload_pm2
|
||||||
|
|
||||||
|
if [[ $command != "reload" ]]; then
|
||||||
if [[ $AutoStartBot == true ]]; then
|
if [[ $AutoStartBot == true ]]; then
|
||||||
log_with_style "INFO" "🤖 4. 启动 bot..."
|
log_with_style "INFO" "🤖 4. 启动 bot..."
|
||||||
nohup ql bot >$dir_log/bot.log 2>&1 &
|
nohup ql bot >$dir_log/bot.log 2>&1 &
|
||||||
|
@ -122,5 +121,6 @@ fi
|
||||||
|
|
||||||
pm2 startup
|
pm2 startup
|
||||||
pm2 save
|
pm2 save
|
||||||
|
fi
|
||||||
|
|
||||||
log_with_style "SUCCESS" "🎉 容器启动成功!"
|
log_with_style "SUCCESS" "🎉 启动成功!"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user