Loading...

Check used files of process

I have to work recently with a Fraud Prevention and Detection solution and needed to check in the enormous configuration which resources are used.

I wrote a custom script that tells me the used process id.

riskshield@omega:~> rsservice status
============================================================
[  OK  ] RiskShield Decision Server is  running
============================================================
riskshield    11738     1  1 15:40 pts/0    00:00:14 /usr/bin/java -Drss.configuration.propertiesFile=../rss_config.properties -Djava.library.path=/opt/RiskShield/Resources/RS-Server/current/bin -server -Xmx32G -Xms32G -classpath /usr/share/java/*:/opt/RiskShield/DecisionServer/.:/opt/RiskShield/Resources/JDBC/ojdbc6.jar:/opt/RiskShield/Resources/RS-Server/current/lib/*:/opt/RiskShield/Resources/JmsQueue/* -XX:+UseG1GC -Xloggc:/var/log/RiskShield/cur/decision_server_gc-201606011540.log -verbose:GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=25 -XX:GCLogFileSize=100K com.riskshield.server.Starter -idecision_server.ini start
============================================================
[  OK  ] RiskShield Data Server is  running
============================================================
riskshield    11743     1  0 15:40 pts/0    00:00:09 /usr/bin/java -Drss.configuration.propertiesFile=../rss_config.properties -Djava.library.path=/opt/RiskShield/Resources/RS-Server/current/bin -server -Xmx4G -Xms4G -classpath /usr/share/java/*:/opt/RiskShield/DataServer/.:/opt/RiskShield/Resources/JDBC/ojdbc6.jar:/opt/RiskShield/Resources/RS-Server/current/lib/* -XX:+UseG1GC -Xloggc:/var/log/RiskShield/cur/data_server_gc-201606011540.log -verbose:GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=25 -XX:GCLogFileSize=100K com.riskshield.server.Starter -idata_server.ini start
============================================================
[  OK  ] RiskShield Back Office Component is  running , process 11747
============================================================
============================================================
[  OK  ] File Watchdog for RiskShield is  running
============================================================
riskshield    11789     1  0 15:40 pts/0    00:00:00 bash /home/riskshield/bin/file-watchdog.sh start
riskshield    11794 11789  0 15:40 pts/0    00:00:00 bash /home/riskshield/bin/file-watchdog.sh start
============================================================
bash(11789)-+-bash(11794)
            `-inotifywait(11791)

With the retrieved process id I can check the used libraries and files. Example output truncated.

riskshield@omega:~> ls -l /proc/11738/fd
total 0
lr-x------ 1 riskshield riskshield 64 Jun  1 15:57 0 -> /dev/null
l-wx------ 1 riskshield riskshield 64 Jun  1 15:57 1 -> /dev/null
lr-x------ 1 riskshield riskshield 64 Jun  1 15:57 10 -> /opt/RiskShield/Resources/RS-Server/4.32a/lib/derby.jar
lr-x------ 1 riskshield riskshield 64 Jun  1 15:57 100 -> /opt/RiskShield/Resources/RS-Server/4.32a/lib/servlet-api-3.1.jar
lrwx------ 1 riskshield riskshield 64 Jun  1 15:57 101 -> socket:[91725601]
lrwx------ 1 riskshield riskshield 64 Jun  1 15:57 102 -> socket:[91725602]
...
lrwx------ 1 riskshield riskshield 64 Jun  1 15:57 128 -> anon_inode:[eventpoll]
lr-x------ 1 riskshield riskshield 64 Jun  1 15:57 129 -> pipe:[91548343]
lr-x------ 1 tpiss rshld 64 Jun  1 15:57 99 -> /opt/RiskShield/Resources/RS-Server/4.32a/lib/rss.api.jar