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. 创建配置 / 重置配置"