删除无用代码

This commit is contained in:
hanhh
2021-06-20 20:33:18 +08:00
parent d630f34505
commit 3052b48f51
10 changed files with 29 additions and 23 deletions
+7 -3
View File
@@ -4,16 +4,20 @@
dir_shell=/ql/shell
. $dir_shell/share.sh
echo -e "1. 开始安装青龙依赖\n"
echo -e "1. 开始检测配置文件\n"
fix_config
echo -e "配置文件检测完成\n"
echo -e "2. 开始安装青龙依赖\n"
npm_install_2 $dir_root
echo -e "青龙依赖安装完成\n"
echo -e "2. 开始安装脚本依赖\n"
echo -e "3. 开始安装脚本依赖\n"
cp -f $dir_sample/package.json $dir_scripts/package.json
npm_install_2 $dir_scripts
echo -e "脚本依赖安装完成\n"
echo -e "3. 复制通知文件\n"
echo -e "4. 复制通知文件\n"
echo -e "复制一份 $file_notify_py_sample$file_notify_py\n"
cp -fv $file_notify_py_sample $file_notify_py
echo
+15
View File
@@ -24,6 +24,9 @@ file_config_user=$dir_config/config.sh
file_auth_sample=$dir_sample/auth.sample.json
file_auth_user=$dir_config/auth.json
file_extra_shell=$dir_config/extra.sh
file_task_before=$dir_config/task_before.sh
file_task_after=$dir_config/task_after.sh
file_task_sample=$dir_sample/task.sample.sh
file_extra_sample=$dir_sample/extra.sample.sh
file_notify_js_sample=$dir_sample/notify.js
file_notify_py_sample=$dir_sample/notify.py
@@ -162,6 +165,18 @@ fix_config() {
echo
fi
if [ ! -f $file_task_before ]; then
echo -e "复制一份 $file_task_sample$file_task_before\n"
cp -fv $file_task_sample $file_task_before
echo
fi
if [ ! -f $file_task_after ]; then
echo -e "复制一份 $file_task_sample$file_task_after\n"
cp -fv $file_task_sample $file_task_after
echo
fi
if [ ! -f $file_extra_shell ]; then
echo -e "复制一份 $file_extra_sample$file_extra_shell\n"
cp -fv $file_extra_sample $file_extra_shell
+5 -7
View File
@@ -50,9 +50,9 @@ usage() {
define_cmd
gen_array_scripts
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
echo -e "3.$cmd_task <file_name> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
echo -e "3.$cmd_task <file_name> conc <环境变量名> # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
if [[ ${#array_scripts[*]} -gt 0 ]]; then
echo -e "\n当前有以下脚本可以运行:"
for ((i = 0; i < ${#array_scripts[*]}; i++)); do
@@ -74,11 +74,8 @@ run_normal() {
local p1=$1
cd $dir_scripts
define_program "$p1"
. $file_task_before
if [[ $p1 == *.js ]]; then
if [[ $AutoHelpOther == true ]] && [[ $(ls $dir_code) ]]; then
local latest_log=$(ls -r $dir_code | head -1)
. $dir_code/$latest_log
fi
if [[ $# -eq 1 ]]; then
random_delay
fi
@@ -92,6 +89,7 @@ run_normal() {
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1$" | perl -pe "s|.*ID=(.*) $cmd_task $p1$|\1|" | xargs | sed 's/ /","/g')
update_cron_status "\"$id\"" "0"
timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path
. $file_task_after
update_cron_status "\"$id\"" "1"
}
-1
View File
@@ -244,7 +244,6 @@ usage() {
echo -e "3. $cmd_update raw <fileurl> # 更新单个脚本文件"
echo -e "4. $cmd_update repo <repourl> <path> <blacklist> <dependence> <branch> # 更新单个仓库的脚本"
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
echo -e "6. $cmd_update code # 获取互助码"
echo -e "6. $cmd_update bot # 启动tg-bot"
echo -e "7. $cmd_update reset # 重置青龙基础环境"
}