From 7e1dc0079a10e78bb009cdf73267712709b35b19 Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Mon, 20 Jul 2026 15:46:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8F=9C=E5=8D=95=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/install.sh b/install.sh index 038aace..dbace7a 100644 --- a/install.sh +++ b/install.sh @@ -41,11 +41,36 @@ install_dependencies(){ } +# 查询运行状态 +check_container_status(){ + local COMPOSE_FILE="./docker-compose.yml" + + local GREEN='\033[0;32m' + local RED='\033[0;31m' + local RESET='\033[0m' + + local STATUS + STATUS=$(docker compose -f "$COMPOSE_FILE" ps --status running --quiet 2>/dev/null) + + if [ -n "$STATUS" ]; then + echo -e "${GREEN}运行中${RESET}" + else + echo -e "${RED}未运行${RESET}" + fi +} + + + main(){ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin" # 脚本文件夹路径 source "${script_dir}/utils/base.sh" + local container_status=$(check_container_status) + # 显示菜单 + echo "" + echo 运行状态: $container_status + echo "==============================" echo "请选择一个操作:" echo "1. 一键部署" echo "2. 创建配置 / 重置配置"