From 0360ba0b1e6ee2f70c0cc83ff165e62c46de1067 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sun, 13 Jun 2021 18:34:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E7=8A=B6=E6=80=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/api.sh | 6 +++--- shell/task.sh | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/shell/api.sh b/shell/api.sh index b5bec373..2c2384c2 100755 --- a/shell/api.sh +++ b/shell/api.sh @@ -133,7 +133,7 @@ del_cron_api() { get_user_info() { local currentTimeStamp=$(date +%s) local api=$( - curl -s "http://localhost:5700/api/user?t=$currentTimeStamp" \ + curl -s "http://localhost:5600/api/user?t=$currentTimeStamp" \ -H 'Accept: */*' \ -H "Authorization: Bearer $token" \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' \ @@ -153,7 +153,7 @@ update_cron_status() { local status=$2 local currentTimeStamp=$(date +%s) local api=$( - curl -s "http://localhost:5700/api/crons/status?t=$currentTimeStamp" \ + curl -s "http://localhost:5600/api/crons/status?t=$currentTimeStamp" \ -X 'PUT' \ -H "Accept: application/json" \ -H "Authorization: Bearer $token" \ @@ -162,7 +162,7 @@ update_cron_status() { -H "Origin: http://localhost:5700" \ -H "Referer: http://localhost: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\"}" \ + --data-raw "{\"ids\":[$ids],\"status\":\"$status\"}" \ --compressed ) code=$(echo $api | jq -r .code) diff --git a/shell/task.sh b/shell/task.sh index 35e3ae6c..9ea31d87 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -3,6 +3,7 @@ ## 导入通用变量与函数 dir_shell=/ql/shell . $dir_shell/share.sh +. $dir_shell/api.sh ## 组合Cookie和互助码子程序,$1:要组合的内容 combine_sub() { @@ -120,11 +121,11 @@ run_normal() { log_dir="$dir_log/${log_dir_tmp%%.*}" log_path="$log_dir/$log_time.log" make_dir "$log_dir" - + local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1$" | perl -pe "s|.*ID=(.*) $cmd_task $p1$|\1|" | xargs | sed 's/ /","/g') - local status="0" ## 0 任务运行中 - update_cron_status "\"$id\"" $status + update_cron_status "\"$id\"" "0" timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path + update_cron_status "\"$id\"" "1" } ## 并发执行,因为是并发,所以日志只能直接记录在日志文件中(日志文件以Cookie编号结尾),前台执行并发跑时不会输出日志