#!/bin/sh
PATH=/usr/bin:$PATH
EG_HOME=/opt/egurkha
export PATH EG_HOME
#============================================================================
# stop_agent: shell script that starts discovery
#=============================================================================

pid_list=`ps -aef -o pid,args | grep "egtuxwriter" | grep -v grep | awk '{print $1}'` 
#get the list of pids 
if [ "$pid_list" ] 	# if egtuxwriter is running
then
	for pid in $pid_list    # for each pid
	do
		# kill each child
		kill -9 $pid > /dev/null 2>&1 
	done
fi

pid_list=`ps -aef -o pid,args | grep "egtuxw" | grep -v grep | awk '{print $1}'` 
#get the list of pids 
if [ "$pid_list" ] 	# if egtuxwriter is running
then
	for pid in $pid_list    # for each pid
	do
		# kill each child
		kill -9 $pid > /dev/null 2>&1 
	done
fi

if [ -z "$1" ]
then
	echo "*************************************************"
	echo "The egtuxwriter has been stopped successfully."
	echo "*************************************************"
fi

