for attempt in $(seq 1 $MAX_RETRY); do echo"Attempt ${attempt}: Triggering fstab mounts..."
if /bin/mount -a 2>&1; then echo"✅ Mount command executed successfully" else echo"⚠️ Mount command returned error (continuing anyway)" fi
# 直接检查两个挂载点是否均已挂载 if mountpoint -q "$MOUNT_POINT_PHOTOS" && mountpoint -q "$MOUNT_POINT_MEDIAS"; then echo"✅ Both mount points accessible" success=true break fi
[[ $attempt -lt $MAX_RETRY ]] && echo"⏳ Mount failed. Retrying in $RETRY_DELAY seconds..." sleep$RETRY_DELAY done
if$success; then echo"✅ Mount succeeded! Managing Docker containers..." for container in"${CONTAINERS[@]}"; do if ! docker inspect "$container" >/dev/null 2>&1; then echo"⚠️ Container '$container' does not exist. Skipping..." continue fi status=$(docker inspect -f '{{.State.Status}}'"$container" 2>/dev/null) case"$status"in "running") echo"🔵 Container '$container' is already running" ;; "exited"|"created"|"paused"|"") echo"🟢 Starting container: $container" docker start "$container" && echo"✅ Started $container" || echo"❌ Failed to start $container" ;; *) echo"⚠️ Container '$container' in unknown state: $status" ;; esac done exit 0 else echo"❌ ERROR: Mount failed after $MAX_RETRY attempts" >&2 exit 1 fi