修复更新定时状态参数

This commit is contained in:
hanhh 2021-06-13 18:34:12 +08:00
parent 1923ceb5c2
commit 0360ba0b1e
2 changed files with 7 additions and 6 deletions

View File

@ -133,7 +133,7 @@ del_cron_api() {
get_user_info() { get_user_info() {
local currentTimeStamp=$(date +%s) local currentTimeStamp=$(date +%s)
local api=$( local api=$(
curl -s "http://localhost:5700/api/user?t=$currentTimeStamp" \ curl -s "http://localhost:5600/api/user?t=$currentTimeStamp" \
-H 'Accept: */*' \ -H 'Accept: */*' \
-H "Authorization: Bearer $token" \ -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' \ -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 status=$2
local currentTimeStamp=$(date +%s) local currentTimeStamp=$(date +%s)
local api=$( local api=$(
curl -s "http://localhost:5700/api/crons/status?t=$currentTimeStamp" \ curl -s "http://localhost:5600/api/crons/status?t=$currentTimeStamp" \
-X 'PUT' \ -X 'PUT' \
-H "Accept: application/json" \ -H "Accept: application/json" \
-H "Authorization: Bearer $token" \ -H "Authorization: Bearer $token" \
@ -162,7 +162,7 @@ update_cron_status() {
-H "Origin: http://localhost:5700" \ -H "Origin: http://localhost:5700" \
-H "Referer: http://localhost:5700/crontab" \ -H "Referer: http://localhost:5700/crontab" \
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ -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 --compressed
) )
code=$(echo $api | jq -r .code) code=$(echo $api | jq -r .code)

View File

@ -3,6 +3,7 @@
## 导入通用变量与函数 ## 导入通用变量与函数
dir_shell=/ql/shell dir_shell=/ql/shell
. $dir_shell/share.sh . $dir_shell/share.sh
. $dir_shell/api.sh
## 组合Cookie和互助码子程序$1要组合的内容 ## 组合Cookie和互助码子程序$1要组合的内容
combine_sub() { combine_sub() {
@ -122,9 +123,9 @@ run_normal() {
make_dir "$log_dir" 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 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\"" "0"
update_cron_status "\"$id\"" $status
timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path
update_cron_status "\"$id\"" "1"
} }
## 并发执行因为是并发所以日志只能直接记录在日志文件中日志文件以Cookie编号结尾前台执行并发跑时不会输出日志 ## 并发执行因为是并发所以日志只能直接记录在日志文件中日志文件以Cookie编号结尾前台执行并发跑时不会输出日志