#!/bin/bash set -e BASE="/workspace/livestream-platform" echo "[livestream] Starting services..." cd "$BASE/mediamtx" if pgrep -f "mediamtx mediamtx.yml" > /dev/null; then echo "[livestream] MediaMTX already running." else nohup ./mediamtx mediamtx.yml > /tmp/mediamtx.log 2>&1 & sleep 2 echo "[livestream] MediaMTX started." fi cd "$BASE/backend" if curl -sf http://127.0.0.1:8080/api/health > /dev/null 2>&1; then echo "[livestream] Backend already running." else nohup ./venv/bin/python run.py > /tmp/backend.log 2>&1 & sleep 3 echo "[livestream] Backend started on :8080." fi cd "$BASE/frontend" if curl -sf http://127.0.0.1:5173 > /dev/null 2>&1; then echo "[livestream] Frontend already running." else nohup npm run dev > /tmp/frontend.log 2>&1 & sleep 3 echo "[livestream] Frontend started on :5173." fi echo "[livestream] All services up."