#!/bin/bash echo "========================================" echo "Starting 4-Camera Simulation" echo "========================================" echo "" echo "This will start 4 virtual cameras in background" echo "Each camera will use the same webcam but with different ports" echo "" echo "Camera URLs will be:" echo "Camera 1: http://10.101.1.4:8080/snapshot" echo "Camera 2: http://10.101.1.4:8081/snapshot" echo "Camera 3: http://10.101.1.4:8082/snapshot" echo "Camera 4: http://10.101.1.4:8083/snapshot" echo "" # Function to start camera in new terminal start_camera() { local camera_id=$1 echo "Starting Camera $camera_id..." # Try different terminal emulators if command -v gnome-terminal &> /dev/null; then gnome-terminal --title="Camera $camera_id" -- bash -c "python3 multi_camera_simulator.py $camera_id; read -p 'Press Enter to close...'" elif command -v xterm &> /dev/null; then xterm -title "Camera $camera_id" -e "python3 multi_camera_simulator.py $camera_id; read -p 'Press Enter to close...'" & elif command -v konsole &> /dev/null; then konsole --title "Camera $camera_id" -e bash -c "python3 multi_camera_simulator.py $camera_id; read -p 'Press Enter to close...'" & elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS osascript -e "tell application \"Terminal\" to do script \"cd $(pwd) && python3 multi_camera_simulator.py $camera_id\"" else echo "No suitable terminal emulator found. Starting in background..." python3 multi_camera_simulator.py $camera_id & echo "Camera $camera_id PID: $!" fi sleep 1 } # Start all 4 cameras start_camera 1 start_camera 2 start_camera 3 start_camera 4 echo "" echo "========================================" echo "All 4 cameras started!" echo "========================================" echo "" echo "Use these URLs in your CMS:" echo "" echo "Camera 1 (Yellow border):" echo " ID: webcam-camera-01" echo " Snapshot: http://10.101.1.4:8080/snapshot" echo " RTSP: rtsp://10.101.1.4:8550/stream" echo "" echo "Camera 2 (Magenta border):" echo " ID: webcam-camera-02" echo " Snapshot: http://10.101.1.4:8081/snapshot" echo " RTSP: rtsp://10.101.1.4:8551/stream" echo "" echo "Camera 3 (Green border):" echo " ID: webcam-camera-03" echo " Snapshot: http://10.101.1.4:8082/snapshot" echo " RTSP: rtsp://10.101.1.4:8552/stream" echo "" echo "Camera 4 (Blue border):" echo " ID: webcam-camera-04" echo " Snapshot: http://10.101.1.4:8083/snapshot" echo " RTSP: rtsp://10.101.1.4:8553/stream" echo "" echo "To stop all cameras, close the terminal windows or press Ctrl+C in each" echo "" # Keep script running read -p "Press Enter to exit..."