Files

12 lines
691 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
PIDS=()
cleanup(){ trap - EXIT INT TERM; for pid in "${PIDS[@]}"; do kill "${pid}" 2>/dev/null || true; done; for pid in "${PIDS[@]}"; do wait "${pid}" 2>/dev/null || true; done; }
trap cleanup EXIT INT TERM
(cd "${PROJECT_ROOT}/backend/iot-server" && go run ./cmd/main/main.go -config etc/platform_iot_server_dev.yaml) & PIDS+=("$!")
(cd "${PROJECT_ROOT}/backend/iot-gateway" && go run ./cmd/main/main.go -config etc/platform_iot_gateway_dev.yaml) & PIDS+=("$!")
echo "IoT Server :12428 与 IoT Gateway :12429 已启动。"
wait -n "${PIDS[@]}"