修复ql命令日志

This commit is contained in:
hanhh
2021-06-25 15:50:04 +08:00
parent ce3543779e
commit 86e5f208fb
3 changed files with 46 additions and 18 deletions
+19 -8
View File
@@ -392,21 +392,25 @@ main() {
local p4=$4
local p5=$5
local p6=$6
log_time=$(date "+%Y-%m-%d-%H-%M-%S")
log_path="$dir_log/update/${log_time}_$p1.log"
local log_time=$(date "+%Y-%m-%d-%H-%M-%S")
local log_path="$dir_log/update/${log_time}_$p1.log"
local begin_time=$(date '+%Y-%m-%d %H:%M:%S')
case $p1 in
update)
update_qinglong "$2" | tee $log_path
echo -e "开始执行... $begin_time\n" >> $log_path
update_qinglong "$2" | tee -a $log_path
;;
extra)
echo -e "开始执行... $begin_time\n" >> $log_path
run_extra_shell | tee -a $log_path
;;
repo)
get_user_info
local name=$(echo "${p2##*/}" | awk -F "." '{print $1}')
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 $log_path
update_repo "$p2" "$p3" "$p4" "$p5" "$p6" | tee -a $log_path
else
echo -e "命令输入错误...\n"
usage
@@ -416,27 +420,34 @@ main() {
get_user_info
local name=$(echo "${p2##*/}" | awk -F "." '{print $1}')
log_path="$dir_log/update/${log_time}_$name.log"
echo -e "开始执行... $begin_time\n" >> $log_path
if [[ -n $p2 ]]; then
update_raw "$p2" | tee $log_path
update_raw "$p2" | tee -a $log_path
else
echo -e "命令输入错误...\n"
usage
fi
;;
rmlog)
. $dir_shell/rmlog.sh "$p2" | tee $log_path
echo -e "开始执行... $begin_time\n" >> $log_path
. $dir_shell/rmlog.sh "$p2" | tee -a $log_path
;;
bot)
. $dir_shell/bot.sh
echo -e "开始执行... $begin_time\n" >> $log_path
. $dir_shell/bot.sh | tee -a $log_path
;;
reset)
. $dir_shell/reset.sh
echo -e "开始执行... $begin_time\n" >> $log_path
. $dir_shell/reset.sh | tee -a $log_path
;;
*)
echo -e "命令输入错误...\n"
usage
;;
esac
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" >> $log_path
}
main "$@"