end0tknr's kipple - 新web写経開発

http://d.hatena.ne.jp/end0tknr/ から移転しました

linux netstat or lsof でポートを使用するプロセス(プログラム)を確認

sonarqube-7.7 を install後、起動を試みるも、できなかったので、調査。

$ ./sonar.sh console
Running SonarQube...
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    | 
jvm 1    | 2019.04.02 20:24:47 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /home/end0tknr/local/sonarqube-7.7/temp
jvm 1    | 2019.04.02 20:24:47 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1    | 2019.04.02 20:24:48 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/home/end0tknr/local/sonarqube-7.7/elasticsearch]: /home/end0tknr/local/sonarqube-7.7/elasticsearch/bin/elasticsearch
jvm 1    | 2019.04.02 20:24:48 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | 2019.04.02 20:24:49 INFO  app[][o.e.p.PluginsService] no modules loaded
jvm 1    | 2019.04.02 20:24:49 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1    | OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
jvm 1    | 2019.04.02 20:25:38 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
jvm 1    | 2019.04.02 20:25:38 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
jvm 1    | 2019.04.02 20:25:38 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
wrapper  | <-- Wrapper Stopped

で、以下の通り

$ sudo netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN      3570/perl           
tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      3037/python         
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      3117/smbd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3041/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3568/master         
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      3117/smbd           
tcp6       0      0 :::3306                 :::*                    LISTEN      3328/mysqld         
tcp6       0      0 :::139                  :::*                    LISTEN      3117/smbd           
tcp6       0      0 :::80                   :::*                    LISTEN      3035/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      3041/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      3568/master         
tcp6       0      0 :::445                  :::*                    LISTEN      3117/smbd           
$

更に lsof コマンドで詳細確認

$ sudo lsof -i :9001
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
superviso 3037 root    4u  IPv4  24613      0t0  TCP localhost:etlservicemgr (LISTEN)
$

最終的に、supervisord が9001ポートを既に使用していることが分かります