ps -ef | grep java | wc -l


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps -ef | grep java | wc -l
# 8  
Old 03-24-2009
hi rikxik,
what will be the output for ur script does it is starting the java daemon or it just checking the daemon status. i neeed to start the alone daemons which is stopped. can u please explain in details about ur script

thanks
suresh
# 9  
Old 03-24-2009
I have added comments to my post. If you still don't understand, you need to put some effort in learning the basics.
# 10  
Old 03-24-2009
Thanks for ur time...... i hope i got the answer, but i have a question u just gave the script to start the daemon right. But i need to check the daemon first then if not the my 5 daemons not running its need to check which is not running then have to run the particular java daemon. not the all daemons... please help mee...
# 11  
Old 03-24-2009
Well, you didn't get the answer. I hate to state the obvious; the script is checking each daemon and starting which ever is down. If 3 are running and 2 are down, it will start only those two. Why don't you bring down couple of daemons and try running it?
# 12  
Old 03-24-2009
U can try this

====================================================
#!/bin/ksh
i=1
while [ $i -le 5 ];do

proc=java$i
JAVA=`ps -aef |grep -v grep| grep -c $proc`
if [ $JAVA == 1 ]
then
echo " $proc already running"
else
/test/java/scripts/daemons/startjava$i
fi
i=$(( $i + 1 ))
done
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PS -EF | GREP JAVA Modification

Hi, When I do ps -ef | grep java I get the following output on my server, But how to get just the last line and the pid....something like:- wasadmin@ccos2104:TEST:bin> ps -ef | grep java wasadmin 5935 54288 0 12:39 pts/8 00:00:00 grep java ccos2104Cell ccos2104 aa ... (2 Replies)
Discussion started by: crosairs
2 Replies
Login or Register to Ask a Question