1Panel-dev / 1Panel

🔥 Top-Rated Web-Based Linux Server Management Tool. 1Panel features an intuitive web interface that seamlessly integrates server management and monitoring, container management, database administration, website management, system backup and restoration, and more, letting you streamlines your server management experience.
https://www.1panel.cn
GNU General Public License v3.0
23.28k stars 2.12k forks source link

[Feature] When executing a command with a progress bar in a scheduled task, the log is abnormal. #7242

Open Firfr opened 2 days ago

Firfr commented 2 days ago

1Panel Version

社区版: v1.10.21-lts

Please describe your needs or suggestions for improvements

在计划任务中执行 例如 docker pull xhofe/alist:latest 时,在报告记录中,其中进度条的部分显示不正常

Please describe the solution you suggest

No response

Additional Information

No response

wanghe-fit2cloud commented 1 day ago

麻烦提供一下相关的截图或其他信息,帮忙我们更好地定位问题。

1Panel-bot commented 1 day ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Please provide relevant screenshots or other information to help us better locate the problem.

Firfr commented 1 day ago

我模拟了一个输出进度条的代码

#!/bin/bash

# 进度条函数
print_progress_bar() {
    local percent=$1
    local width=50  # 进度条的宽度
    local filled=$((percent * width / 100))
    local bar=""

    for ((i=0; i<filled; i++)); do
        bar+="█"
    done

    for ((i=filled; i<width; i++)); do
        bar+=" "
    done

    echo -ne "\r[ ${bar} ] ${percent}%"
}

# 模拟进度
for percent in $(seq 0 1 100); do
    print_progress_bar $percent
    sleep 0.05  # 模拟进度的延迟
done

echo  # 最后换行

在计划任务中的输出 2024-12-03_15-35-06

手动执行后的输出 2024-12-03_15-35-23

ssongliu commented 19 hours ago

感谢反馈,这里是编码的问题,下个版本优化

1Panel-bot commented 19 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Thanks for the feedback. This is a coding problem and will be optimized in the next version.