#!/bin/bash
PID_LIST=`ps -efo comm,pid,args | grep haproxy.cfg | grep -v grep | awk '{print $2}'`
FINAL_PID=`echo $PID_LIST | sed -E 's/haproxy//g'`
kill -9  $FINAL_PID
exit 0

#!/bin/bash
PID_LIST=`ps -eo comm,pid,args | grep haproxy.cfg | grep -v grep | awk '{print $2}'`
FINAL_PID=`echo $PID_LIST | sed -E 's/haproxy//g'`
kill -9  $FINAL_PID
exit 0

Kill Ha proxy is not working as it is not listing the process which is not attached to the shell
Kill Ha proxy is not working as it is not listing the process which is not attached to the shell