From 4d99695e4c663cd997c6fd73c163f5252ecf27da Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Mon, 23 Aug 2021 15:58:25 +0800 Subject: [PATCH] =?UTF-8?q?task=E4=BC=A0=E9=80=92=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=BB=99task=5Fbefore=E5=92=8Ctask=5Fafter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/task.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/task.sh b/shell/task.sh index 3a8fa3d7..49916976 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -97,11 +97,11 @@ run_normal() { local id=$(cat $list_crontab_user | grep -E "$cmd_task $first_param" | perl -pe "s|.*ID=(.*) $cmd_task $first_param\.*|\1|" | head -1 | awk -F " " '{print $1}') [[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path" - eval . $file_task_before $cmd + eval . $file_task_before "$@" $cmd eval timeout -k 10s $command_timeout_time $which_program $first_param $cmd - eval . $file_task_after $cmd + eval . $file_task_after "$@" $cmd [[ $id ]] && update_cron "\"$id\"" "1" "" "$log_path" local end_time=$(date '+%Y-%m-%d %H:%M:%S') local diff_time=$(($(date +%s -d "$end_time") - $(date +%s -d "$begin_time"))) @@ -133,7 +133,7 @@ run_concurrent() { local id=$(cat $list_crontab_user | grep -E "$cmd_task $first_param" | perl -pe "s|.*ID=(.*) $cmd_task $first_param\.*|\1|" | head -1 | awk -F " " '{print $1}') [[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path" - eval . $file_task_before $cmd + eval . $file_task_before "$@" $cmd local envs=$(eval echo "\$${third_param}") local array=($(echo $envs | sed 's/&/ /g')) @@ -151,7 +151,7 @@ run_concurrent() { [ -f $single_log_path ] && rm -f $single_log_path done - eval . $file_task_after $cmd + eval . $file_task_after "$@" $cmd [[ $id ]] && update_cron "\"$id\"" "1" "" "$log_path" local end_time=$(date '+%Y-%m-%d %H:%M:%S') local diff_time=$(($(date +%s -d "$end_time") - $(date +%s -d "$begin_time"))) @@ -174,11 +174,11 @@ run_else() { local id=$(cat $list_crontab_user | grep -E "$cmd_task $first_param" | perl -pe "s|.*ID=(.*) $cmd_task $first_param\.*|\1|" | head -1 | awk -F " " '{print $1}') [[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path" - eval . $file_task_before $cmd + eval . $file_task_before "$@" $cmd eval timeout -k 10s $command_timeout_time "$@" $cmd - eval . $file_task_after $cmd + eval . $file_task_after "$@" $cmd [[ $id ]] && update_cron "\"$id\"" "1" "" "$log_path" local end_time=$(date '+%Y-%m-%d %H:%M:%S') local diff_time=$(($(date +%s -d "$end_time") - $(date +%s -d "$begin_time")))