修复日志路径拼接规则

This commit is contained in:
whyour
2022-04-03 19:32:44 +08:00
parent 8fac58d73f
commit d687e79b6c
2 changed files with 61 additions and 31 deletions
+11 -1
View File
@@ -408,7 +408,17 @@ export default class CronService {
command.lastIndexOf('.') !== -1
? command.lastIndexOf('.')
: command.length;
return command.substring(start, end);
const tmpStr = command.startsWith('/') ? command.substring(1) : command;
const index = tmpStr.indexOf('/') !== -1 ? tmpStr.indexOf('/') : 0;
if (index) {
console.log(
`${tmpStr.substring(0, index)}_${command.substring(start, end)}`,
);
return `${tmpStr.substring(0, index)}_${command.substring(start, end)}`;
} else {
return command.substring(start, end);
}
}
private make_command(tab: Crontab) {