diff --git a/back/services/cron.ts b/back/services/cron.ts index ebe94e6e..ddec21ec 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -90,15 +90,15 @@ export default class CronService { status, pid, log_path, - last_running_time, - last_execution_time, + last_running_time = 0, + last_execution_time = 0, }: { ids: string[]; status: CrontabStatus; pid: number; log_path: string; - last_running_time: string; - last_execution_time: string; + last_running_time: number; + last_execution_time: number; }) { return new Promise((resolve) => { this.cronDb.update( diff --git a/shell/api.sh b/shell/api.sh index 770980ce..81c3d7ed 100755 --- a/shell/api.sh +++ b/shell/api.sh @@ -153,8 +153,8 @@ update_cron() { local status="$2" local pid="${3:-''}" local logPath="$4" - local lastExecutingTime="${5:-''}" - local runningTime="${6:-''}" + local lastExecutingTime="${5:-0}" + local runningTime="${6:-0}" local currentTimeStamp=$(date +%s) local api=$( curl -s --noproxy "*" "http://0.0.0.0:5600/api/crons/status?t=$currentTimeStamp" \ @@ -166,7 +166,7 @@ update_cron() { -H "Origin: http://0.0.0.0:5700" \ -H "Referer: http://0.0.0.0:5700/crontab" \ -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ - --data-raw "{\"ids\":[$ids],\"status\":\"$status\",\"pid\":\"$pid\",\"log_path\":\"$logPath\",\"last_execution_time\":\"$lastExecutingTime\",\"last_running_time\":\"$runningTime\"}" \ + --data-raw "{\"ids\":[$ids],\"status\":\"$status\",\"pid\":\"$pid\",\"log_path\":\"$logPath\",\"last_execution_time\":$lastExecutingTime,\"last_running_time\":$runningTime}" \ --compressed ) code=$(echo $api | jq -r .code) diff --git a/shell/task.sh b/shell/task.sh index 28a4e17b..f0b8967b 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -113,8 +113,8 @@ run_normal() { ## 并发执行时,设定的 RandomDelay 不会生效,即所有任务立即执行 run_concurrent() { - local first_param=$1 - local third_param=$3 + local first_param="$1" + local third_param="$2" if [[ ! $third_param ]]; then echo -e "\n 缺少并发运行的环境变量参数" exit 1