修复有可能手动运行任务无日志

This commit is contained in:
whyour
2024-05-25 00:28:55 +08:00
parent 8dd379b6b9
commit b309ac7613
7 changed files with 30 additions and 17 deletions
+7 -12
View File
@@ -348,20 +348,13 @@ export default class SystemService {
}
}
public async run(
{ command, logPath }: { command: string; logPath: string },
callback: TaskCallbacks,
) {
public async run({ command }: { command: string }, callback: TaskCallbacks) {
if (!command.startsWith(TASK_COMMAND)) {
command = `${TASK_COMMAND} ${command}`;
}
this.scheduleService.runTask(
`real_log_path=${logPath} real_time=true ${command}`,
callback,
{
command,
},
);
this.scheduleService.runTask(`real_time=true ${command}`, callback, {
command,
});
}
public async stop({ command, pid }: { command: string; pid: number }) {
@@ -388,7 +381,9 @@ export default class SystemService {
public async exportData(res: Response) {
try {
await promiseExec(`cd ${config.rootPath} && tar -zcvf ${config.dataTgzFile} data/`);
await promiseExec(
`cd ${config.rootPath} && tar -zcvf ${config.dataTgzFile} data/`,
);
res.download(config.dataTgzFile);
} catch (error: any) {
return res.send({ code: 400, message: error.message });