mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改tee参数
This commit is contained in:
parent
dac694776d
commit
cc238dedbc
|
@ -170,9 +170,9 @@ update_cron() {
|
|||
code=$(echo $api | jq -r .code)
|
||||
message=$(echo $api | jq -r .message)
|
||||
if [[ $code == 200 ]]; then
|
||||
echo -e "## 更新任务状态成功" | tee -a $log_path
|
||||
echo -e "## 更新任务状态成功" | tee --output-error=warn -a $log_path
|
||||
else
|
||||
echo -e "## 更新任务状态失败(${message})" | tee -a $log_path
|
||||
echo -e "## 更新任务状态失败(${message})" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -91,25 +91,25 @@ run_normal() {
|
|||
|
||||
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1" | perl -pe "s|.*ID=(.*) $cmd_task $p1\.*|\1|" | head -1 | awk -F " " '{print $1}')
|
||||
local begin_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "## 开始执行... $begin_time\n" | tee -a $log_path
|
||||
echo -e "## 开始执行... $begin_time\n" | tee --output-error=warn -a $log_path
|
||||
[[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path"
|
||||
if [[ ! $(. $file_task_before) ]]; then
|
||||
. $file_task_before
|
||||
else
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
|
||||
timeout $command_timeout_time $which_program $p1 2>&1 | tee -a $log_path
|
||||
timeout $command_timeout_time $which_program $p1 2>&1 | tee --output-error=warn -a $log_path
|
||||
|
||||
if [[ ! $(. $file_task_after) ]]; then
|
||||
. $file_task_after
|
||||
else
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
[[ $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")))
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee -a $log_path
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee --output-error=warn -a $log_path
|
||||
}
|
||||
|
||||
## 并发执行时,设定的 RandomDelay 不会生效,即所有任务立即执行
|
||||
|
@ -133,14 +133,14 @@ run_concurrent() {
|
|||
|
||||
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1" | perl -pe "s|.*ID=(.*) $cmd_task $p1\.*|\1|" | head -1 | awk -F " " '{print $1}')
|
||||
local begin_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "## 开始执行... $begin_time\n" | tee -a $log_path
|
||||
echo -e "## 开始执行... $begin_time\n" | tee --output-error=warn -a $log_path
|
||||
[[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path"
|
||||
if [[ ! $(. $file_task_before) ]]; then
|
||||
. $file_task_before
|
||||
else
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
echo -e "\n各账号间已经在后台开始并发执行,前台不输入日志,日志直接写入文件中。\n" | tee -a $log_path
|
||||
echo -e "\n各账号间已经在后台开始并发执行,前台不输入日志,日志直接写入文件中。\n" | tee --output-error=warn -a $log_path
|
||||
|
||||
single_log_time=$(date "+%Y-%m-%d-%H-%M-%S.%N")
|
||||
for i in "${!array[@]}"; do
|
||||
|
@ -152,12 +152,12 @@ run_concurrent() {
|
|||
if [[ ! $(. $file_task_after) ]]; then
|
||||
. $file_task_after
|
||||
else
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
[[ $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")))
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee -a $log_path
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee --output-error=warn -a $log_path
|
||||
}
|
||||
|
||||
## 运行其他命令
|
||||
|
@ -170,25 +170,25 @@ run_else() {
|
|||
|
||||
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1" | perl -pe "s|.*ID=(.*) $cmd_task $p1\.*|\1|" | head -1 | awk -F " " '{print $1}')
|
||||
local begin_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "## 开始执行... $begin_time\n" | tee -a $log_path
|
||||
echo -e "## 开始执行... $begin_time\n" | tee --output-error=warn -a $log_path
|
||||
[[ $id ]] && update_cron "\"$id\"" "0" "$$" "$log_path"
|
||||
if [[ ! $(. $file_task_before) ]]; then
|
||||
. $file_task_before
|
||||
else
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_before执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
|
||||
timeout $command_timeout_time "$@" 2>&1 | tee -a $log_path
|
||||
timeout $command_timeout_time "$@" 2>&1 | tee --output-error=warn -a $log_path
|
||||
|
||||
if [[ ! $(. $file_task_after) ]]; then
|
||||
. $file_task_after
|
||||
else
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee -a $log_path
|
||||
echo -e "## task_after执行失败,自行检查\n" | tee --output-error=warn -a $log_path
|
||||
fi
|
||||
[[ $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")))
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee -a $log_path
|
||||
echo -e "\n## 执行结束... $end_time 耗时 $diff_time 秒" | tee --output-error=warn -a $log_path
|
||||
}
|
||||
|
||||
## 命令检测
|
||||
|
|
|
@ -403,11 +403,11 @@ main() {
|
|||
case $p1 in
|
||||
update)
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
update_qinglong "$2" | tee -a $log_path
|
||||
update_qinglong "$2" | tee --output-error=warn -a $log_path
|
||||
;;
|
||||
extra)
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
run_extra_shell | tee -a $log_path
|
||||
run_extra_shell | tee --output-error=warn -a $log_path
|
||||
;;
|
||||
repo)
|
||||
get_user_info
|
||||
|
@ -415,7 +415,7 @@ main() {
|
|||
log_path="$dir_log/update/${log_time}_$name.log"
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
if [[ -n $p2 ]]; then
|
||||
update_repo "$p2" "$p3" "$p4" "$p5" "$p6" | tee -a $log_path
|
||||
update_repo "$p2" "$p3" "$p4" "$p5" "$p6" | tee --output-error=warn -a $log_path
|
||||
else
|
||||
echo -e "命令输入错误...\n"
|
||||
usage
|
||||
|
@ -427,7 +427,7 @@ main() {
|
|||
log_path="$dir_log/update/${log_time}_$name.log"
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
if [[ -n $p2 ]]; then
|
||||
update_raw "$p2" | tee -a $log_path
|
||||
update_raw "$p2" | tee --output-error=warn -a $log_path
|
||||
else
|
||||
echo -e "命令输入错误...\n"
|
||||
usage
|
||||
|
@ -435,15 +435,15 @@ main() {
|
|||
;;
|
||||
rmlog)
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
. $dir_shell/rmlog.sh "$p2" | tee -a $log_path
|
||||
. $dir_shell/rmlog.sh "$p2" | tee --output-error=warn -a $log_path
|
||||
;;
|
||||
bot)
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
. $dir_shell/bot.sh | tee -a $log_path
|
||||
. $dir_shell/bot.sh | tee --output-error=warn -a $log_path
|
||||
;;
|
||||
check)
|
||||
echo -e "## 开始执行... $begin_time\n" >> $log_path
|
||||
. $dir_shell/check.sh | tee -a $log_path
|
||||
. $dir_shell/check.sh | tee --output-error=warn -a $log_path
|
||||
;;
|
||||
*)
|
||||
echo -e "命令输入错误...\n"
|
||||
|
|
Loading…
Reference in New Issue
Block a user