i am using 'psu' to grep the status of a process like below :-
psu|grep -i agentf
29559 29552 0 00:53:05 ? 0:57 gn1avm_agent -n AGENTF1
28946 1 0 00:51:31 ? 0:31 gnavm_ewd -b gn1avm_agent -n AGENTF1 -c -n AGENTF1
29552 28946 0 00:53:05 ? 0:00 /bin/ksh /olclocal/fs_users/tksfr01/abp_home/core/bin/gn1_preAvm_Ksh -b gn1avm_agent -c -n AGENTF1
out of these three process, RED process(first process) is IMP for me , i want to track this but problem is that - Orange colour process(2nd process) is also having same search pattern and it also comes with grep command .this orange process comes UP first and so my script/job checking 'psu' status shows - it's UP. but in fact , till now only Orange process is up not RED , RED process is still coming up and takes 2 more mins.
i want to check right status of RED process at right time.
if i use below command:-
psu | grep 'gn1avm_agent -n AGENTF1' | grep -v '\-c' | grep -v grep -> it gives right status , but now , it wil lbe treated as
psu | grep �gn1avm_agent -n AGENTF1| grep -v '\-c'' which will return nothing.
so how to grep it , my script checking this status is :-
DaemonPIDs=`ps -ex | grep -v -e grep | grep "${DaemonExeName}
ps -ex | grep -v -e grep | grep "gn1avm_agent -n AGENTF1"
29559 ? 0:59 gn1avm_agent -n AGENTF1
28946 ? 0:31 gnavm_ewd -b gn1avm_agent -n AGENTF1 -c -n AGENTF1
+ CheckDaemonStatus
+ + ssh host -l account -qn ps -ex
+ grep -w gn1avm_agent -n AGENTF1
+ grep -v -e grep -e amc1_vrts_gen_monitor_ksh -e opcmon
so hot to get rid of this problem , pls suggest.