finger / run_multiple.sh
huzey's picture
init
1a01fdb
#!/bin/bash
# Kill any existing Python processes running on these ports
for port in {7850..7869}; do
lsof -ti:$port | xargs kill -9 2>/dev/null
done
# Start 10 instances of the app
for port in {7850..7869}; do
echo "Starting app on port $port"
python app.py --port $port &
# Store the process ID
echo $! > "app_$port.pid"
# Wait a bit between launches to prevent port conflicts
sleep 2
done
echo "All apps started. To stop them, run: ./stop_apps.sh"