• 获取linux服务进程号


     ps -ef | grep "服务名" | grep -v "grep" | awk '{print $2}'

    # ps -ef|grep "被查询的服务名"  查询服务进程号命令 
    # grep -v grep  在文档中过滤掉包含有grep字符的行   
    # awk '{print $2}' 一行一行的读取指定的文件, 以空格作为分隔符,打印第二个字段。

     示例如下:

    [upay@jy-cash03 app]$ ps -ef | grep tomcat|grep /app/upay/apps/xcharge-simulator_01/bin | grep -v grep
    upay 16675 1 0 14:07 pts/1 00:00:46 /opt/app/xcharge/jdk/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/app/upay/apps/xcharge-simulator_01/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/app/upay/apps/xcharge-simulator_01/endorsed -classpath /app/upay/apps/xcharge-simulator_01/bin/bootstrap.jar:/app/upay/apps/xcharge-simulator_01/bin/tomcat-juli.jar -Dcatalina.base=/app/upay/apps/xcharge-simulator_01 -Dcatalina.home=/app/upay/apps/xcharge-simulator_01 -Djava.io.tmpdir=/app/upay/apps/xcharge-simulator_01/temp org.apache.catalina.startup.Bootstrap start
    [upay@jy-cash03 app]$
    [upay@jy-cash03 app]$
    [upay@jy-cash03 app]$ ps -ef | grep tomcat|grep /app/upay/apps/xcharge-simulator_01/bin | grep -v grep|awk '{print $2}'
    16675

  • 相关阅读:
    datalist标签
    meter标签
    audio标签
    video标签
    time标签
    figure标签
    正则收集
    js文字无缝滚动
    页面滚动到指定位置
    Css公共文件结构
  • 原文地址:https://www.cnblogs.com/apple2016/p/9455490.html
Copyright © 2020-2023  润新知