#!/bin/sh set -e # Thoát ngay lập tức nếu có lệnh nào thất bại echo "Checking /health endpoint..." health_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:${PORT}/health") if [ "$health_status" -eq 200 ] || [ "$health_status" -eq 404 ]; then echo "/health check passed with status ${health_status}" exit 0 fi echo "/health check failed with status ${health_status}. Checking / endpoint..." root_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:${PORT}/") if [ "$root_status" -eq 200 ] || [ "$root_status" -eq 404 ]; then echo "/ check passed with status ${root_status}" exit 0 fi echo "/ check failed with status ${root_status}. Health check failed overall." exit 1