From: laredotornado on
Hi,

I'm using Mac 10.6.3 with Tomcat 6.0.26. Does anyone know, in bash
shell, how can I get the PID of a Tomcat process? When I do

ps -ef | grep java,

I get this:

65421 405 1 0 0:24.05 ?? 2:29.34 /Applications/
StarTeam CPC.app/Contents/MacOS/java/bin/java -jar /Applications/
StarTeam CPC.app/Contents/MacOS/st/lib/starteam-gui.jar
65421 2217 2181 0 2:04.89 ?? 7:53.36 /System/Library/
Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx640M -
Xms128M -Xverify:none -
Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -
XX:MaxPermSize=128M -Dide.AssertTracingDisabled=true -
Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
Djava.util.logging.config.file=logging.conf -Dsqldev.debug=false -
Dcom.apple.mrj.application.apple.menu.about.name=SQL_Developer -
Dcom.apple.mrj.application.growbox.intrudes=false -
Dcom.apple.macos.smallTabs=true -Dapple.laf.useScreenMenuBar=true -
Xbootclasspath/p:../../rdbms/jlib/ojdi.jar -Dide.conf="/Applications/
SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/
sqldeveloper.conf" -Dide.startingcwd="/Applications/SQLDeveloper.app/
Contents/Resources/sqldeveloper/sqldeveloper/bin" -classpath ../../ide/
lib/ide-boot.jar oracle.ide.boot.Launcher
65421 13396 1 0 0:06.83 ttys000 0:36.32 /Library/Java/Home/
bin/java -Djava.util.logging.config.file=/Library/Tomcat/Home/conf/
logging.properties -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
DLVCVAConfigurationRoot=/Library/Tomcat/Home/lvcvaConf -
Dinversoft.profanity.profiler.enabled=true -Djava.endorsed.dirs=/
Library/Tomcat/Home/endorsed -Djava.endorsed.dirs=/Library/Tomcat/Home/
endorsed -classpath /Library/Tomcat/Home/bin/bootstrap.jar -
Dcatalina.base=/Library/Tomcat/Home -Dcatalina.home=/Library/Tomcat/
Home -Djava.io.tmpdir=/Library/Tomcat/Home/temp
org.apache.catalina.startup.Bootstrap start


Note that I only want the PID of the third process, which is the
Tomcat one. Thanks, - Dave
From: Gary Gorbet on
In article
<c50af75b-f400-40a7-9074-d71d720435be(a)x20g2000pro.googlegroups.com>,
laredotornado <laredotornado(a)zipmail.com> wrote:

> Hi,
>
> I'm using Mac 10.6.3 with Tomcat 6.0.26. Does anyone know, in bash
> shell, how can I get the PID of a Tomcat process? When I do
>
> ps -ef | grep java,
>
> I get this:
>
> 65421 405 1 0 0:24.05 ?? 2:29.34 /Applications/
> StarTeam CPC.app/Contents/MacOS/java/bin/java -jar /Applications/
> StarTeam CPC.app/Contents/MacOS/st/lib/starteam-gui.jar
> 65421 2217 2181 0 2:04.89 ?? 7:53.36 /System/Library/
> Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx640M -
> Xms128M -Xverify:none -
> Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
> Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -
> XX:MaxPermSize=128M -Dide.AssertTracingDisabled=true -
> Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
> Djava.util.logging.config.file=logging.conf -Dsqldev.debug=false -
> Dcom.apple.mrj.application.apple.menu.about.name=SQL_Developer -
> Dcom.apple.mrj.application.growbox.intrudes=false -
> Dcom.apple.macos.smallTabs=true -Dapple.laf.useScreenMenuBar=true -
> Xbootclasspath/p:../../rdbms/jlib/ojdi.jar -Dide.conf="/Applications/
> SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/
> sqldeveloper.conf" -Dide.startingcwd="/Applications/SQLDeveloper.app/
> Contents/Resources/sqldeveloper/sqldeveloper/bin" -classpath ../../ide/
> lib/ide-boot.jar oracle.ide.boot.Launcher
> 65421 13396 1 0 0:06.83 ttys000 0:36.32 /Library/Java/Home/
> bin/java -Djava.util.logging.config.file=/Library/Tomcat/Home/conf/
> logging.properties -
> Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
> DLVCVAConfigurationRoot=/Library/Tomcat/Home/lvcvaConf -
> Dinversoft.profanity.profiler.enabled=true -Djava.endorsed.dirs=/
> Library/Tomcat/Home/endorsed -Djava.endorsed.dirs=/Library/Tomcat/Home/
> endorsed -classpath /Library/Tomcat/Home/bin/bootstrap.jar -
> Dcatalina.base=/Library/Tomcat/Home -Dcatalina.home=/Library/Tomcat/
> Home -Djava.io.tmpdir=/Library/Tomcat/Home/temp
> org.apache.catalina.startup.Bootstrap start
>
>
> Note that I only want the PID of the third process, which is the
> Tomcat one. Thanks, - Dave

I would say that

ps -aef|grep Tomcat|awk '{print $2}'

would get you what you want.
From: Kevin McMurtrie on
In article <180720101906380857%ggorbet(a)comcast.net>,
Gary Gorbet <ggorbet(a)comcast.net> wrote:

> In article
> <c50af75b-f400-40a7-9074-d71d720435be(a)x20g2000pro.googlegroups.com>,
> laredotornado <laredotornado(a)zipmail.com> wrote:
>
> > Hi,
> >
> > I'm using Mac 10.6.3 with Tomcat 6.0.26. Does anyone know, in bash
> > shell, how can I get the PID of a Tomcat process? When I do
> >
> > ps -ef | grep java,
> >
> > I get this:
> >
> > 65421 405 1 0 0:24.05 ?? 2:29.34 /Applications/
> > StarTeam CPC.app/Contents/MacOS/java/bin/java -jar /Applications/
> > StarTeam CPC.app/Contents/MacOS/st/lib/starteam-gui.jar
> > 65421 2217 2181 0 2:04.89 ?? 7:53.36 /System/Library/
> > Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx640M -
> > Xms128M -Xverify:none -
> > Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
> > Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -
> > XX:MaxPermSize=128M -Dide.AssertTracingDisabled=true -
> > Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -
> > Djava.util.logging.config.file=logging.conf -Dsqldev.debug=false -
> > Dcom.apple.mrj.application.apple.menu.about.name=SQL_Developer -
> > Dcom.apple.mrj.application.growbox.intrudes=false -
> > Dcom.apple.macos.smallTabs=true -Dapple.laf.useScreenMenuBar=true -
> > Xbootclasspath/p:../../rdbms/jlib/ojdi.jar -Dide.conf="/Applications/
> > SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/
> > sqldeveloper.conf" -Dide.startingcwd="/Applications/SQLDeveloper.app/
> > Contents/Resources/sqldeveloper/sqldeveloper/bin" -classpath ../../ide/
> > lib/ide-boot.jar oracle.ide.boot.Launcher
> > 65421 13396 1 0 0:06.83 ttys000 0:36.32 /Library/Java/Home/
> > bin/java -Djava.util.logging.config.file=/Library/Tomcat/Home/conf/
> > logging.properties -
> > Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
> > DLVCVAConfigurationRoot=/Library/Tomcat/Home/lvcvaConf -
> > Dinversoft.profanity.profiler.enabled=true -Djava.endorsed.dirs=/
> > Library/Tomcat/Home/endorsed -Djava.endorsed.dirs=/Library/Tomcat/Home/
> > endorsed -classpath /Library/Tomcat/Home/bin/bootstrap.jar -
> > Dcatalina.base=/Library/Tomcat/Home -Dcatalina.home=/Library/Tomcat/
> > Home -Djava.io.tmpdir=/Library/Tomcat/Home/temp
> > org.apache.catalina.startup.Bootstrap start
> >
> >
> > Note that I only want the PID of the third process, which is the
> > Tomcat one. Thanks, - Dave
>
> I would say that
>
> ps -aef|grep Tomcat|awk '{print $2}'
>
> would get you what you want.

Almost. There's more than one app in the Tomcat path and there's a race
condition where your search command might match itself.

ps -e -o pid,command \
| grep 'org\.apache\.catalina\.startup\.Bootstrap' \
| awk '{print $1}'
--
I won't see Google Groups replies because I must filter them as spam
 | 
Pages: 1
Prev: System prefs problem
Next: DU and Partition Map