Quote:
Originally Posted by
crosairs
Hi,
When I do ps -ef | grep java I get the following output on my server, But how to get jsut the last line and the pid....something like
Code :
wasadmin@ccos2104:TEST:bin> ps -ef | grep java
wasadmin 5935 54288 0 12:39 pts/8 00:00:00 grep java
ccos2104Cell ccos2104 aa
==============================================
wasadmin@ccos2104:TEST:bin> ps -ef | grep java
wasadmin 5935 54288 0 12:39 pts/8 00:00:00 grep java
wasadmin 14813 1 1 Jan14 ? 18:16:42 /u01/was85/java/bin/java -Declipse.security -Dwas.status.socket=35920 -Dosgi.install.area=/u01/was85 -Dosgi.configuration.area=/u01/was85/profiles/appsrv/servers/aa/configuration -Djava.awt.headless=true -Dosgi.framework.extensions=com.ibm.cds,com.ibm.ws.eclipse.adaptors -Xshareclasses:name=webspherev85_1.6_64_%g,nonFatal -Dcom.ibm.xtq.processor.overrideSecureProcessing=true -Xbootclasspath/p:/u01/was85/java/jre/lib/ibmorb.jar -classpath /u01/was85/profiles/appsrv/properties:/u01/was85/properties:/u01/was85/lib/startup.jar:/u01/was85/lib/bootstrap.jar:/u01/was85/lib/jsf-nls.jar:/u01/was85/lib/lmproxy.jar:/u01/was85/lib/urlprotocols.jar:/u01/was85/deploytool/itp/batchboot.jar:/u01/was85/deploytool/itp/batch2.jar:/u01/was85/java/lib/tools.jar -Dibm.websphere.internalClassAccessMode=allow -verbose:gc -Xms2560m -Xmx2560m -Xcompressedrefs -Xscmaxaot4M -Xscmx90M -Dws.ext.dirs=/u01/was85/java/lib:/u01/was85/profiles/appsrv/classes:/u01/was85/classes:/u01/was85/lib:/u01/was85/installedChannels:/u01/was85/lib/ext:/u01/was85/web/help:/u01/was85/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime -Dderby.system.home=/u01/was85/derby -Dcom.ibm.itp.location=/u01/was85/bin -Djava.util.logging.configureByServer=true -Duser.install.root=/u01/was85/profiles/appsrv -Djava.ext.dirs=/u01/was85/tivoli/tam:/u01/was85/java/jre/lib/ext -Djavax.management.builder.initial=com.ibm.ws.management.PlatformMBeanServerBuilder -Dpython.cachedir=/u01/was85/profiles/appsrv/temp/cachedir -Dwas.install.root=/u01/was85 -Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager -Dserver.root=/u01/was85/profiles/appsrv -Dcom.ibm.security.jgss.debug=off -Dcom.ibm.security.krb5.Krb5Debug=off -Dprobe.id=ccos2104_nwideweb_net-aa -Dprobe.log.dir=/u01/was85/profiles/appsrv/logs/aa -Dserver.log.root=/u01/was85/profiles/appsrv/logs/aa -Djava.library.path=/u01/was85/lib/native/linux/x86_64/:/u01/was85/java/jre/lib/amd64/compressedrefs:/u01/was85/java/jre/lib/amd64:/u01/was85/bin:/u01/was85/nulldllsdir:/usr/lib: -Djava.endorsed.dirs=/u01/was85/endorsed_apis:/u01/was85/java/jre/lib/endorsed -Djava.security.auth.login.config=/u01/was85/profiles/appsrv/properties/wsjaas.conf -Djava.security.policy=/u01/was85/profiles/appsrv/properties/server.policy com.ibm.wsspi.bootstrap.WSPreLauncher -nosplash -application com.ibm.ws.bootstrap.WSLauncher com.ibm.ws.runtime.WsServer /u01/was85/profiles/appsrv/config ccos2104Cell ccos2104 aa
Hello crosairs,
Quote:
When I do ps -ef | grep java I get the following output on my server, But how to get jsut 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
The first line
wasadmin 5935 54288 0 12:39 pts/8 00:00:00 grep java
is NOT a actual process it is a process of the command itself, so if you do the following command it shoult not come then.
Code :
ps -ef | grep -v "grep" | grep java
Now if we want to get output for
ccos2104Cell ccos2104 aa then following may help.
Code :
ps -ef | grep -v "grep" | grep "java" | awk '{print $(NF-2) OFS $(NF-1) OFS $NF}'
On a Solaris/SunOS system, change
awk to
/usr/xpg4/bin/awk ,
/usr/xpg6/bin/awk , or
nawk . Hope this helps.
Thanks,
R. Singh