From 8f70ddc2cee50f77225238271ecc9f3ca97f1f88 Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Sat, 10 Jan 2026 19:14:10 +0800 Subject: [PATCH] update --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 0201a11..fbca21b 100644 --- a/install.sh +++ b/install.sh @@ -2,11 +2,11 @@ restart_docker(){ # 如果docker容器没有启动, 则退出 - local container_status=$(docker-compose -f ./docker-compose.yml ps -q | xargs docker inspect -f '{{.State.Running}}') - if [ -z "$container_status" ] || [ "$container_status" != "true" ]; then + local running_count=$(docker-compose -f ./docker-compose.yml ps -q | wc -l) + if [ "$running_count" -eq 0 ]; then echo "容器未启动, 无需重启" return - fi + fi echo "正在重启容器..." docker-compose -f ./docker-compose.yml down