执行命令:ps -ef|grep tomcat|grep /opt/upay3/application/dispatcherTomcat/bin
输出的进程信息会显示2个:包括grep本身的进程+你查询的进程
dispatcherTomcatInfo: ['upay3 4627 1 11 14:27 pts/0 00:00:50 /usr/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/opt/upay3/application/dispatcherTomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/upay3/application/dispatcherTomcat/endorsed -classpath /opt/upay3/application/dispatcherTomcat/bin/bootstrap.jar:/opt/upay3/application/dispatcherTomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/upay3/application/dispatcherTomcat -Dcatalina.home=/opt/upay3/application/dispatcherTomcat -Djava.io.tmpdir=/opt/upay3/application/dispatcherTomcat/temp org.apache.catalina.startup.Bootstrap start\n', 'upay3 4753 4752 0 14:34 ? 00:00:00 bash -c ps -ef|grep tomcat|grep /opt/upay3/application/dispatcherTomcat/bin\n']
执行命令:ps -ef|grep tomcat|grep /opt/upay3/application/dispatcherTomcat/bin|grep -v grep
输出的只有你查询的进程:
dispatcherTomcatInfo: ['upay3 4627 1 4 14:27 pts/0 00:01:02 /usr/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/opt/upay3/application/dispatcherTomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/upay3/application/dispatcherTomcat/endorsed -classpath /opt/upay3/application/dispatcherTomcat/bin/bootstrap.jar:/opt/upay3/application/dispatcherTomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/upay3/application/dispatcherTomcat -Dcatalina.home=/opt/upay3/application/dispatcherTomcat -Djava.io.tmpdir=/opt/upay3/application/dispatcherTomcat/temp org.apache.catalina.startup.Bootstrap start\n']