移除部分历史兼容逻辑

This commit is contained in:
whyour 2025-05-09 15:37:05 +08:00
parent 425e49675a
commit da639a1f8f
3 changed files with 28 additions and 84 deletions

View File

@ -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

View File

@ -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

View File

@ -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=""