From 7f66e0624db097436ec13ea546a2313169402163 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 12 May 2021 17:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index c4761895..5742aa1c 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -170,27 +170,30 @@ export default class CronService { ); cmd.stdout.on('data', (data) => { - this.logger.silly(`stdout: ${data}`); + this.logger.info(`stdout: ${data}`); fs.appendFileSync(logFile, data); }); cmd.stderr.on('data', (data) => { - this.logger.error(`stderr: ${data}`); + this.logger.info(`stderr: ${data}`); fs.appendFileSync(logFile, data); }); cmd.on('close', (code) => { - this.logger.silly(`child process exited with code ${code}`); - this.cronDb.update({ _id }, { $set: { status: CrontabStatus.idle } }); + this.logger.info(`child process exited with code ${code}`); + this.cronDb.update( + { _id }, + { $set: { status: CrontabStatus.idle }, $unset: { pid: true } }, + ); }); cmd.on('error', (err) => { - this.logger.silly(err); + this.logger.info(err); fs.appendFileSync(logFile, err.stack); }); cmd.on('exit', (code: number, signal: any) => { - this.logger.silly(`cmd exit ${code}`); + this.logger.info(`cmd exit ${code}`); this.cronDb.update( { _id }, { $set: { status: CrontabStatus.idle }, $unset: { pid: true } }, @@ -199,7 +202,7 @@ export default class CronService { }); cmd.on('disconnect', () => { - this.logger.silly(`cmd disconnect`); + this.logger.info(`cmd disconnect`); this.cronDb.update({ _id }, { $set: { status: CrontabStatus.idle } }); fs.appendFileSync(logFile, `\n\n连接断开...`); });