#!/bin/bash # Array to hold the process IDs declare -a pids PYTHONPATH="/home/juni/PycharmProjects/segmentation_overlapping" # Start multiple Python processes in the background python hls_streaming/hls.py --cctv_num 0 & pids+=($!) python hls_streaming/hls.py --cctv_num 1 & pids+=($!) python test.py pids+=($!) # Function to kill all processes cleanup() { echo "Terminating all processes..." for pid in "${pids[@]}"; do kill -9 $pid done } # Trap keyboard interrupt and call cleanup trap cleanup SIGINT # Print message echo "Running... Press Ctrl+C to stop." # Wait forever until Ctrl+C is pressed while true; do sleep 1 done