diff --git a/back/services/cron.ts b/back/services/cron.ts index ddec21ec..5644a227 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -241,19 +241,19 @@ export default class CronService { } private async killTask(name: string) { - let taskCommond = `ps -ef | grep "${name}" | grep -v grep | awk '{print $1}'`; + let taskCommand = `ps -ef | grep "${name}" | grep -v grep | awk '{print $1}'`; const execAsync = promisify(exec); try { - let pid = (await execAsync(taskCommond)).stdout; + let pid = (await execAsync(taskCommand)).stdout; if (pid) { pid = (await execAsync(`pstree -p ${pid}`)).stdout; } else { return; } - const pids = pid.match(/\d+/g); + const pids = pid.match(/\(\d+/g); const killLogs = []; for (const id of pids) { - const c = `kill -9 ${id}`; + const c = `kill -9 ${id.slice(1)}`; const { stdout, stderr } = await execAsync(c); if (stderr) { killLogs.push(stderr);