定时任务增加运行任务前和运行任务后参数

This commit is contained in:
whyour
2023-09-19 22:44:32 +08:00
parent 8d899f1a53
commit ab3fc9b5f1
11 changed files with 88 additions and 36 deletions
+12
View File
@@ -436,11 +436,23 @@ handle_task_before() {
[[ $is_macos -eq 0 ]] && check_server
. $file_task_before "$@"
if [[ $task_before ]]; then
echo -e "执行前置命令\n"
eval "$task_before"
echo -e "\n执行前置命令结束\n"
fi
}
handle_task_after() {
. $file_task_after "$@"
if [[ $task_after ]]; then
echo -e "\n执行后置命令\n"
eval "$task_after"
echo -e "\n执行后置命令结束"
fi
local etime=$(date "+$time_format")
local end_time=$(format_time "$time_format" "$etime")
local end_timestamp=$(format_timestamp "$time_format" "$etime")