From 5ddc9ac22e0145f470d0a9caf3a96514f21090e8 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 12 May 2021 20:36:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=87=8D=E5=90=AF=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E6=89=A7=E8=A1=8C=E4=B8=80=E6=AC=A1=E6=89=80=E6=9C=89?= =?UTF-8?q?ql=20repo=20=E5=92=8C=20ql=20raw=E7=9A=84=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index cad935a9..8d0681d4 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -1,3 +1,4 @@ +import { exec } from 'child_process'; import { Container } from 'typedi'; import { Crontab, CrontabStatus } from '../data/cron'; import CronService from '../services/cron'; @@ -48,6 +49,7 @@ export default async () => { } }); + // patch更新面板任务状态 cronDb.find({ name: '更新面板' }).exec((err, docs) => { const doc = docs[0]; if (doc && doc.status === CrontabStatus.running) { @@ -57,6 +59,18 @@ export default async () => { ); } }); + + // 初始化时执行一次所有的ql repo 任务 + cronDb + .find({ + command: /ql (repo|raw)/, + }) + .exec((err, docs) => { + for (let i = 0; i < docs.length; i++) { + const doc = docs[i]; + exec(doc.command); + } + }); }; function randomSchedule(from: number, to: number) {