From 444836975dc156e31e53796582fd4ac8a4d6e0d7 Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 14 Oct 2022 23:02:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ql=20=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index 50229120..e66d8fa5 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -432,14 +432,25 @@ main() { local p5=$5 local p6=$6 local p7=$7 + local log_dir="${dir_log}/${p1}" + make_dir "${log_dir}" local log_time=$(date "+%Y-%m-%d-%H-%M-%S") - local log_path="$dir_log/update/$p1_${log_time}.log" - local begin_time=$(date '+%Y-%m-%d %H:%M:%S') + local log_path="${log_dir}/${log_time}.log" cmd=">> $log_path 2>&1" [[ "$show_log" == "true" ]] && cmd="" [[ -f $task_error_log_path ]] && cat $task_error_log_path $cmd + if [[ "$show_log" == "true" ]] && [[ $ID ]]; then + eval echo -e "请移除 -l 参数" $cmd + exit 1 + fi + + local time_format="%Y-%m-%d %H:%M:%S" + local time=$(date "+$time_format") + local begin_timestamp=$(format_timestamp "$time_format" "$time") + [[ $ID ]] && update_cron "\"$ID\"" "0" "$$" "$log_path" "$begin_timestamp" + case $p1 in update) eval update_qinglong "$2" $cmd @@ -489,8 +500,12 @@ main() { usage ;; esac + if [[ -f $log_path ]]; then cat $log_path + local end_timestamp=$(date "+%s") + local diff_time=$(($end_timestamp - $begin_timestamp)) + [[ $ID ]] && update_cron "\"$ID\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time" fi }