diff --git a/back/api/script.ts b/back/api/script.ts index 419ace4a..9ad9beb4 100644 --- a/back/api/script.ts +++ b/back/api/script.ts @@ -129,6 +129,7 @@ export default (app: Router) => { content: Joi.string().optional().allow(''), originFilename: Joi.string().optional().allow(''), directory: Joi.string().optional().allow(''), + file: Joi.string().optional().allow(''), }), }), async (req: Request, res: Response, next: NextFunction) => { diff --git a/back/shared/runCron.ts b/back/shared/runCron.ts index 31f3ada4..9ccfdb05 100644 --- a/back/shared/runCron.ts +++ b/back/shared/runCron.ts @@ -15,11 +15,11 @@ export function runCron(cmd: string, cron: ICron): Promise { }); // Default to single instance mode (0) for backward compatibility - const allowMultipleInstances = - existingCron?.allow_multiple_instances === 1; + const allowSingleInstances = + existingCron?.allow_multiple_instances === 0; if ( - !allowMultipleInstances && + allowSingleInstances && existingCron && existingCron.pid && (existingCron.status === CrontabStatus.running || diff --git a/back/validation/schedule.ts b/back/validation/schedule.ts index 475859a1..ed212ab4 100644 --- a/back/validation/schedule.ts +++ b/back/validation/schedule.ts @@ -81,5 +81,5 @@ export const commonCronSchema = { 'string.max': '日志名称不能超过100个字符', 'string.unsafePath': '绝对路径必须在日志目录内或使用 /dev/null', }), - allow_multiple_instances: Joi.number().optional().valid(0, 1), + allow_multiple_instances: Joi.number().optional().valid(0, 1).allow(null), };