diff --git a/back/api/script.ts b/back/api/script.ts index c66b11f2..1b2143e9 100644 --- a/back/api/script.ts +++ b/back/api/script.ts @@ -34,7 +34,6 @@ export default (app: Router) => { async (req: Request, res: Response, next: NextFunction) => { const logger: Logger = Container.get('logger'); try { - console.log(req.params.file); const content = getFileContentByName( `${config.scriptPath}${req.params.file}`, ); diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index 88162747..06d35d42 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -18,13 +18,7 @@ const initData = [ name: '删除日志', command: 'ql rmlog 7', schedule: '30 7 */7 * *', - status: CrontabStatus.idle, - }, - { - name: '互助码', - command: 'ql code', - schedule: '30 7 * * *', - status: CrontabStatus.idle, + status: CrontabStatus.disabled, }, ]; diff --git a/back/services/env.ts b/back/services/env.ts index 16ffd178..79bdd009 100644 --- a/back/services/env.ts +++ b/back/services/env.ts @@ -214,7 +214,6 @@ export default class EnvService { { status: { $ne: EnvStatus.disabled }, name: { $exists: true } }, ); const groups = _.groupBy(envs, 'name'); - console.log(groups); let env_string = ''; for (const key in groups) { if (Object.prototype.hasOwnProperty.call(groups, key)) { diff --git a/sample/task.sample.sh b/sample/task.sample.sh new file mode 100644 index 00000000..f1f641af --- /dev/null +++ b/sample/task.sample.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/shell/reset.sh b/shell/reset.sh index 9003cdb9..376c7225 100644 --- a/shell/reset.sh +++ b/shell/reset.sh @@ -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 diff --git a/shell/share.sh b/shell/share.sh index f0355bd0..ef099ca6 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -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 diff --git a/shell/task.sh b/shell/task.sh index c172a414..8e0d264c 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -50,9 +50,9 @@ usage() { define_cmd gen_array_scripts echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:" - echo -e "1.$cmd_task # 依次执行,如果设置了随机延迟,将随机延迟一定秒数" - echo -e "2.$cmd_task now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中" - echo -e "3.$cmd_task conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中" + echo -e "1.$cmd_task # 依次执行,如果设置了随机延迟,将随机延迟一定秒数" + echo -e "2.$cmd_task now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中" + echo -e "3.$cmd_task 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" } diff --git a/shell/update.sh b/shell/update.sh index 89ea0c6a..cbf155a6 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -244,7 +244,6 @@ usage() { echo -e "3. $cmd_update raw # 更新单个脚本文件" echo -e "4. $cmd_update repo # 更新单个仓库的脚本" echo -e "5. $cmd_update rmlog # 删除旧日志" - echo -e "6. $cmd_update code # 获取互助码" echo -e "6. $cmd_update bot # 启动tg-bot" echo -e "7. $cmd_update reset # 重置青龙基础环境" } diff --git a/src/app.tsx b/src/app.tsx index 71ebfbb2..5130b5f0 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -26,7 +26,6 @@ export function render(oldRender: any) { oldRender(); }) .catch((e) => { - console.log(e); if (e.response && e.response.status === 401) { localStorage.removeItem(config.authKey); history.push('/login'); diff --git a/src/pages/env/editNameModal.tsx b/src/pages/env/editNameModal.tsx index 1affc835..4e0c7e08 100644 --- a/src/pages/env/editNameModal.tsx +++ b/src/pages/env/editNameModal.tsx @@ -16,8 +16,6 @@ const EditNameModal = ({ const [loading, setLoading] = useState(false); const handleOk = async (values: any) => { - console.log(values); - console.log(ids); setLoading(true); const { code, data } = await request.put(`${config.apiPrefix}envs/name`, { data: {