#!/bin/bash
echo "The following node processes were found:"
echo ps aux | grep ":1339" | grep -v grep
nodepids=$(ps -ef | grep ":1339" | grep -v grep | awk '{print $2}')
echo $nodepids
echo "OK, so we will stop these process/es now..."
for nodepid in ${nodepids[@]}
do
echo "Stopping PID :"$nodepid
kill -9 $nodepid
done
echo "Done"
lsof -P | grep ':1339' | awk '{print $2}' | xargs kill -9
exit 0