#!/usr/bin/env bash

PATTERNS="start_voice.api.sh|voice_api.py"

echo "Searching for processes matching: $PATTERNS"
PIDS=$(ps aux | grep -E "$PATTERNS" | grep -v grep | awk '{print $2}')

if [ -z "$PIDS" ]; then
  echo "No matching processes found."
  exit 0
fi

echo "Killing the following PIDs:"
echo "$PIDS"

kill -9 $PIDS
