#!/bin/bash
PATH=/usr/bin:/bin:$PATH
EG_BIN=/opt/egurkha/bin
export EG_BIN PATH
#============================================================================
# stop_agent: shell script that stops Syslog  
#============================================================================

pid_list=`ps -e -o pid,args | grep -i "Syslog" | grep -v "grep" | grep -v "stop_syslogd"| awk '{print $1}'`

#get the list of pids 
if [ "$pid_list" ] 	# if Syslog  is running
then
	for pid in $pid_list    # for each pid
	do
		echo "PID >>>>>>>>>>>>>>>>>> " $pid $args
		# kill each child
		kill -9 $pid #> /dev/null 2>&1 
		#z=1
	done
fi
#if z 
#if [$1]
echo "*************************************************"
echo "Syslog has been stopped successfully."
echo "*************************************************"
#fi 