From e56b70ee5f6c1547014a5bb2ff76e8bec2e87d22 Mon Sep 17 00:00:00 2001 From: Evgeny Volferts Date: Mon, 22 Sep 2025 17:48:09 +0300 Subject: [PATCH] Fix for reading logs --- x-ui.sh | 72 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/x-ui.sh b/x-ui.sh index 949f79b3..6038db7d 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -402,32 +402,54 @@ disable() { } show_log() { - echo -e "${green}\t1.${plain} Debug Log" - echo -e "${green}\t2.${plain} Clear All logs" - echo -e "${green}\t0.${plain} Back to Main Menu" - read -rp "Choose an option: " choice + if [[ $release == "alpine" ]]; then + echo -e "${green}\t1.${plain} Debug Log" + echo -e "${green}\t0.${plain} Back to Main Menu" + read -rp "Choose an option: " choice - case "$choice" in - 0) - show_menu - ;; - 1) - journalctl -u x-ui -e --no-pager -f -p debug - if [[ $# == 0 ]]; then - before_show_menu - fi - ;; - 2) - sudo journalctl --rotate - sudo journalctl --vacuum-time=1s - echo "All Logs cleared." - restart - ;; - *) - echo -e "${red}Invalid option. Please select a valid number.${plain}\n" - show_log - ;; - esac + case "$choice" in + 0) + show_menu + ;; + 1) + grep -F 'x-ui[' /var/log/messages + if [[ $# == 0 ]]; then + before_show_menu + fi + ;; + *) + echo -e "${red}Invalid option. Please select a valid number.${plain}\n" + show_log + ;; + esac + else + echo -e "${green}\t1.${plain} Debug Log" + echo -e "${green}\t2.${plain} Clear All logs" + echo -e "${green}\t0.${plain} Back to Main Menu" + read -rp "Choose an option: " choice + + case "$choice" in + 0) + show_menu + ;; + 1) + journalctl -u x-ui -e --no-pager -f -p debug + if [[ $# == 0 ]]; then + before_show_menu + fi + ;; + 2) + sudo journalctl --rotate + sudo journalctl --vacuum-time=1s + echo "All Logs cleared." + restart + ;; + *) + echo -e "${red}Invalid option. Please select a valid number.${plain}\n" + show_log + ;; + esac + fi } bbr_menu() {