From 91853604820348e25ce68b0d17c76137c99874af Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 5 May 2021 18:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=91=BD=E4=BB=A4=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/api/config.ts | 4 ---- back/config/index.ts | 4 +--- back/schedule.ts | 2 +- back/services/cron.ts | 4 ++-- shell/task.sh | 2 +- src/pages/diff/index.tsx | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/back/api/config.ts b/back/api/config.ts index e900ff75..c52bc637 100644 --- a/back/api/config.ts +++ b/back/api/config.ts @@ -26,10 +26,6 @@ export default (app: Router) => { case 'crontab': content = getFileContentByName(config.crontabFile); break; - case 'shareCode': - let shareCodeFile = getLastModifyFilePath(config.shareCodeDir); - content = getFileContentByName(shareCodeFile); - break; case 'extra': content = getFileContentByName(config.extraFile); break; diff --git a/back/config/index.ts b/back/config/index.ts index 39781407..50cdf73c 100644 --- a/back/config/index.ts +++ b/back/config/index.ts @@ -7,11 +7,10 @@ const envFound = dotenv.config(); const rootPath = path.resolve(__dirname, '../../'); const cookieFile = path.join(rootPath, 'config/cookie.sh'); const confFile = path.join(rootPath, 'config/config.sh'); -const sampleFile = path.join(rootPath, 'sample/config.sh.sample'); +const sampleFile = path.join(rootPath, 'sample/config.sample.sh'); const crontabFile = path.join(rootPath, 'config/crontab.list'); const confBakDir = path.join(rootPath, 'config/bak/'); const authConfigFile = path.join(rootPath, 'config/auth.json'); -const shareCodeDir = path.join(rootPath, 'log/export_sharecodes/'); const extraFile = path.join(rootPath, 'config/extra.sh'); const logPath = path.join(rootPath, 'log/'); const authError = '错误的用户名密码,请重试'; @@ -40,7 +39,6 @@ export default { authError, logPath, extraFile, - shareCodeDir, authConfigFile, confBakDir, crontabFile, diff --git a/back/schedule.ts b/back/schedule.ts index f0e662eb..7af003bd 100644 --- a/back/schedule.ts +++ b/back/schedule.ts @@ -32,7 +32,7 @@ const run = async () => { ) { schedule.scheduleJob(task.schedule, function () { let command = task.command as string; - if (!command.startsWith('task ')) { + if (!command.startsWith('task ') && !command.startsWith('ql ')) { command = `task ${command}`; } exec(command); diff --git a/back/services/cron.ts b/back/services/cron.ts index 97a9b72f..80d1a3cd 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -124,10 +124,10 @@ export default class CronService { fs.writeFileSync(logFile, `开始执行...\n\n${new Date().toString()}\n`); let cmdStr = res.command; - if (!res.command.startsWith('task')) { + if (!cmdStr.startsWith('task') && !cmdStr.startsWith('ql ')) { cmdStr = `task ${cmdStr}`; } - if (res.command.endsWith('.js')) { + if (cmdStr.endsWith('.js')) { cmdStr = `${cmdStr} now`; } const cmd = spawn(cmdStr, { shell: true }); diff --git a/shell/task.sh b/shell/task.sh index 4cb9dff1..0b4529bf 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -77,7 +77,7 @@ gen_array_scripts () { usage () { define_cmd gen_array_scripts - echo -e "\ntask命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:" + echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:" echo -e "1.$cmd_task # 依次执行,如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数" echo -e "2.$cmd_task now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中" echo -e "3.$cmd_task conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中" diff --git a/src/pages/diff/index.tsx b/src/pages/diff/index.tsx index 7906726e..6801c5f1 100644 --- a/src/pages/diff/index.tsx +++ b/src/pages/diff/index.tsx @@ -87,7 +87,7 @@ const Crontab = () => { newValue={sample} splitView={true} leftTitle="config.sh" - rightTitle="config.sh.sample" + rightTitle="config.sample.sh" disableWordDiff={true} /> {/*