zoukankan      html  css  js  c++  java
  • Linux下如何查看定位当前正在运行软件的配置文件

    netstat命令

    用于显示与IP、TCP、UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况
    netstat -lntup
    说明: l:listening n:num t:tcp u:udp p:process

    1. 查看nginx的PID,以常用的80端口为例:
      [root@xiaoyuer scripts]# netstat -lntup|grep 80
      tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13309/nginx

    可以知道nginx进程是13309

    1. 通过相应的进程ID(比如:13309)查询当前运行的nginx路径:

    [root@xiaoyuer scripts]# ll /proc/13309/exe
    lrwxrwxrwx 1 root root 0 Jan 4 17:02 /proc/13309/exe -> /data/nginx/sbin/nginx
    3. 获取到nginx的执行路径后,使用-t参数即可获取该进程对应的配置文件路径,如:

    /usr/local/nginx/sbin/nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
     其实所有的启动命令都是类似

  • 相关阅读:
    jQuery
    数据库的并发操作
    Python之禅
    pymysql模块初见
    数据库之表查询
    实体与实体之间的联系
    数据库初识
    进程池 协程 与I/O模型
    GIL全局解释锁.死锁与递归锁
    进程通信与线程初识
  • 原文地址:https://www.cnblogs.com/isungge/p/14356199.html
Copyright © 2011-2022 走看看