From a7c378aa8c26c1b648f4aeee7242b5c5944d2828 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 12 May 2021 14:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index f0f090cb..c4761895 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -134,7 +134,12 @@ export default class CronService { for (let i = 0; i < docs.length; i++) { const doc = docs[i]; if (doc.pid) { - exec(`kill -9 ${doc.pid}`); + exec(`kill -9 ${doc.pid}`, (err, stdout, stderr) => { + this.cronDb.update( + { _id: doc._id }, + { $set: { status: CrontabStatus.idle }, $unset: { pid: true } }, + ); + }); } } });