修改任务执行日志目录规则

This commit is contained in:
whyour
2022-09-11 19:43:37 +08:00
parent 7354a61184
commit 281ed6cfba
3 changed files with 24 additions and 67 deletions
+3 -2
View File
@@ -18,14 +18,15 @@ const run = async () => {
_schedule &&
_schedule.length > 5 &&
task.status !== CrontabStatus.disabled &&
!task.isDisabled
!task.isDisabled &&
task.schedule
) {
schedule.scheduleJob(task.schedule, function () {
let command = task.command as string;
if (!command.includes('task ') && !command.includes('ql ')) {
command = `task ${command}`;
}
exec(command);
exec(`ID=${task.id} ${command}`);
});
}
}
+1 -1
View File
@@ -412,7 +412,7 @@ export default class CronService {
cmdStr = `${cmdStr} now`;
}
const cp = spawn(cmdStr, { shell: '/bin/bash' });
const cp = spawn(`ID=${id} ${cmdStr}`, { shell: '/bin/bash' });
await CrontabModel.update(
{ status: CrontabStatus.running, pid: cp.pid },