mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
移除部分历史兼容逻辑
This commit is contained in:
parent
425e49675a
commit
da639a1f8f
|
@ -4,7 +4,15 @@ dir_shell=/ql/shell
|
||||||
. $dir_shell/share.sh
|
. $dir_shell/share.sh
|
||||||
. $dir_shell/env.sh
|
. $dir_shell/env.sh
|
||||||
|
|
||||||
echo -e "======================1. 检测配置文件========================\n"
|
log_with_style() {
|
||||||
|
local level="$1"
|
||||||
|
local message="$2"
|
||||||
|
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
|
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_with_style "INFO" "🚀 1. 检测配置文件..."
|
||||||
import_config "$@"
|
import_config "$@"
|
||||||
make_dir /etc/nginx/conf.d
|
make_dir /etc/nginx/conf.d
|
||||||
make_dir /run/nginx
|
make_dir /run/nginx
|
||||||
|
@ -13,31 +21,23 @@ fix_config
|
||||||
|
|
||||||
pm2 l &>/dev/null
|
pm2 l &>/dev/null
|
||||||
|
|
||||||
echo -e "======================2. 安装依赖========================\n"
|
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
||||||
patch_version
|
|
||||||
|
|
||||||
echo -e "======================3. 启动nginx========================\n"
|
|
||||||
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
||||||
echo -e "nginx启动成功...\n"
|
|
||||||
|
|
||||||
echo -e "======================4. 启动pm2服务========================\n"
|
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务...\n"
|
||||||
reload_pm2
|
reload_pm2
|
||||||
|
|
||||||
if [[ $AutoStartBot == true ]]; then
|
if [[ $AutoStartBot == true ]]; then
|
||||||
echo -e "======================5. 启动bot========================\n"
|
log_with_style "INFO" "🤖 4. 启动 bot..."
|
||||||
nohup ql bot >$dir_log/bot.log 2>&1 &
|
nohup ql bot >$dir_log/bot.log 2>&1 &
|
||||||
echo -e "bot后台启动中...\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $EnableExtraShell == true ]]; then
|
if [[ $EnableExtraShell == true ]]; then
|
||||||
echo -e "====================6. 执行自定义脚本========================\n"
|
log_with_style "INFO" "🛠️ 5. 执行自定义脚本..."
|
||||||
nohup ql extra >$dir_log/extra.log 2>&1 &
|
nohup ql extra >$dir_log/extra.log 2>&1 &
|
||||||
echo -e "自定义脚本后台执行中...\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "############################################################\n"
|
log_with_style "SUCCESS" "🎉 容器启动成功!"
|
||||||
echo -e "容器启动成功..."
|
|
||||||
echo -e "############################################################\n"
|
|
||||||
|
|
||||||
crond -f >/dev/null
|
crond -f >/dev/null
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ check_pm2() {
|
||||||
main() {
|
main() {
|
||||||
echo -e "=====> 开始检测"
|
echo -e "=====> 开始检测"
|
||||||
npm i -g pnpm@8.3.1 pm2 ts-node
|
npm i -g pnpm@8.3.1 pm2 ts-node
|
||||||
patch_version
|
|
||||||
|
|
||||||
reset_env
|
reset_env
|
||||||
copy_dep
|
copy_dep
|
||||||
|
|
|
@ -74,7 +74,7 @@ original_name=(
|
||||||
init_env() {
|
init_env() {
|
||||||
local pnpm_global_path=$(pnpm root -g 2>/dev/null)
|
local pnpm_global_path=$(pnpm root -g 2>/dev/null)
|
||||||
export NODE_PATH="/usr/local/bin:/usr/local/lib/node_modules${pnpm_global_path:+:${pnpm_global_path}}"
|
export NODE_PATH="/usr/local/bin:/usr/local/lib/node_modules${pnpm_global_path:+:${pnpm_global_path}}"
|
||||||
|
|
||||||
# 如果存在 pnpm 全局路径,创建软链接
|
# 如果存在 pnpm 全局路径,创建软链接
|
||||||
if [[ -n "$pnpm_global_path" ]]; then
|
if [[ -n "$pnpm_global_path" ]]; then
|
||||||
# 确保目标目录存在
|
# 确保目标目录存在
|
||||||
|
@ -82,7 +82,7 @@ init_env() {
|
||||||
# 链接全局模块到项目的 node_modules
|
# 链接全局模块到项目的 node_modules
|
||||||
ln -sf "${pnpm_global_path}/"* "${dir_root}/node_modules/" 2>/dev/null || true
|
ln -sf "${pnpm_global_path}/"* "${dir_root}/node_modules/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,67 +180,47 @@ fix_config() {
|
||||||
make_dir $dir_dep
|
make_dir $dir_dep
|
||||||
|
|
||||||
if [[ ! -s $file_config_user ]]; then
|
if [[ ! -s $file_config_user ]]; then
|
||||||
echo -e "复制一份 $file_config_sample 为 $file_config_user,随后请按注释编辑你的配置文件:$file_config_user\n"
|
cp -f $file_config_sample $file_config_user
|
||||||
cp -fv $file_config_sample $file_config_user
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $file_task_before ]]; then
|
if [[ ! -f $file_task_before ]]; then
|
||||||
echo -e "复制一份 $file_task_sample 为 $file_task_before\n"
|
cp -f $file_task_sample $file_task_before
|
||||||
cp -fv $file_task_sample $file_task_before
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $file_task_after ]]; then
|
if [[ ! -f $file_task_after ]]; then
|
||||||
echo -e "复制一份 $file_task_sample 为 $file_task_after\n"
|
cp -f $file_task_sample $file_task_after
|
||||||
cp -fv $file_task_sample $file_task_after
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $file_extra_shell ]]; then
|
if [[ ! -f $file_extra_shell ]]; then
|
||||||
echo -e "复制一份 $file_extra_sample 为 $file_extra_shell\n"
|
cp -f $file_extra_sample $file_extra_shell
|
||||||
cp -fv $file_extra_sample $file_extra_shell
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $file_notify_py ]]; then
|
if [[ ! -s $file_notify_py ]]; then
|
||||||
echo -e "复制一份 $file_notify_py_sample 为 $file_notify_py\n"
|
cp -f $file_notify_py_sample $file_notify_py
|
||||||
cp -fv $file_notify_py_sample $file_notify_py
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $file_notify_js ]]; then
|
if [[ ! -s $file_notify_js ]]; then
|
||||||
echo -e "复制一份 $file_notify_js_sample 为 $file_notify_js\n"
|
cp -f $file_notify_js_sample $file_notify_js
|
||||||
cp -fv $file_notify_js_sample $file_notify_js
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $file_test_js ]]; then
|
if [[ ! -s $file_test_js ]]; then
|
||||||
cp -fv $file_test_js_sample $file_test_js
|
cp -f $file_test_js_sample $file_test_js
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $file_test_py ]]; then
|
if [[ ! -s $file_test_py ]]; then
|
||||||
cp -fv $file_test_py_sample $file_test_py
|
cp -f $file_test_py_sample $file_test_py
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -s /etc/nginx/conf.d/default.conf ]]; then
|
if [[ -s /etc/nginx/conf.d/default.conf ]]; then
|
||||||
echo -e "检测到默认nginx配置文件,清空...\n"
|
|
||||||
cat /dev/null >/etc/nginx/conf.d/default.conf
|
cat /dev/null >/etc/nginx/conf.d/default.conf
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $dep_notify_js ]]; then
|
if [[ ! -s $dep_notify_js ]]; then
|
||||||
echo -e "复制一份 $file_notify_js_sample 为 $dep_notify_js\n"
|
cp -f $file_notify_js_sample $dep_notify_js
|
||||||
cp -fv $file_notify_js_sample $dep_notify_js
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s $dep_notify_py ]]; then
|
if [[ ! -s $dep_notify_py ]]; then
|
||||||
echo -e "复制一份 $file_notify_py_sample 为 $dep_notify_py\n"
|
cp -f $file_notify_py_sample $dep_notify_py
|
||||||
cp -fv $file_notify_py_sample $dep_notify_py
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -354,44 +334,9 @@ format_timestamp() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_version() {
|
|
||||||
git config --global pull.rebase false
|
|
||||||
|
|
||||||
if [[ -f "$dir_root/db/cookie.db" ]]; then
|
|
||||||
echo -e "检测到旧的db文件,拷贝为新db...\n"
|
|
||||||
mv $dir_root/db/cookie.db $dir_root/db/env.db
|
|
||||||
rm -rf $dir_root/db/cookie.db
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$dir_root/db" ]]; then
|
|
||||||
echo -e "检测到旧的db目录,拷贝到data目录...\n"
|
|
||||||
cp -rf $dir_root/config $dir_data
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$dir_root/scripts" ]]; then
|
|
||||||
echo -e "检测到旧的scripts目录,拷贝到data目录...\n"
|
|
||||||
cp -rf $dir_root/scripts $dir_data
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$dir_root/log" ]]; then
|
|
||||||
echo -e "检测到旧的log目录,拷贝到data目录...\n"
|
|
||||||
cp -rf $dir_root/log $dir_data
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$dir_root/config" ]]; then
|
|
||||||
echo -e "检测到旧的config目录,拷贝到data目录...\n"
|
|
||||||
cp -rf $dir_root/config $dir_data
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
init_nginx() {
|
init_nginx() {
|
||||||
cp -fv $nginx_conf /etc/nginx/nginx.conf
|
cp -f $nginx_conf /etc/nginx/nginx.conf
|
||||||
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
|
cp -f $nginx_app_conf /etc/nginx/conf.d/front.conf
|
||||||
local location_url="/"
|
local location_url="/"
|
||||||
local aliasStr=""
|
local aliasStr=""
|
||||||
local rootStr=""
|
local rootStr=""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user