#!/bin/bash

PIDS=$(ps ax | grep com.hazelcast.core.server.HazelcastMemberStarter | grep -v grep | awk '{print $1}')

if [ -z "$PIDS" ]; then
  echo "No Hazelcast server found to stop"
  exit 1
else
  kill -s TERM $PIDS
  echo "Stopped Hazelcast instances with the following PIDs:"
  echo "$PIDS"
fi
