1.) Find process listening on port 8888
netstat -plan | grep 8888
The output is
tcp 0 0 :::8888 :::* LISTEN 2700/java
This shows me that a java program at Process ID (PID) 2700 is listening on port 8888
2.) Find process info of PID 2700
ps -fp 2700 | more
The output is
oracle 2700 1 0 18:55 ? 0:00:02
/usr/java/latest/bin/java -Xmx1024m -Xms256m -Dapex.port=8888
-Djava.io.tmpdir=/home/oracle/tmp
-jar/home/oracle/listener/apex.war 2>&1 >/tmp/apexListener.log
This shows me the full command line for PID 2700. Luckily the command line has all the necessary information like program type (Oracle Apex), log location, war file location, temporary directory, etc.
Sometimes we do not get so lucky and the command line is more cryptic. If that is the case, execute command
lsof -p 2700
That command shows a list of open files used by process 2700. That will usually lead to log location and other important files.
...
java 2700 oracle 2w REG 3,1 1700 1796967 /tmp/apex_listener.log
java 2700 oracle 3r REG 3,65 9828505 134585 /home/oracle/listener/apex.war
java 2700 oracle 4r REG 3,1 51796975 361047 /usr/java/jdk1.6.0_20/jre/lib/rt.jar
java 2700 oracle 5r REG 3,65 1869025 132940 /home/oracle/tmp/apex/apex/____embedded/start.jar
java 2700 oracle 6r REG 3,65 1539291 132946 /home/oracle/tmp/apex/apex/WEB-INF/lib/poi-3.6-20091214.jar
...
3.) Find how to stop and start the application
The ps -fp command in step 2 shows me that the parent process PID is 1. (It is the number after 2700).
ps -fp 1 | more
gives the output
root 1 0 0 18:54 ? 00:00:00 init [5]
The command init is the startup script process that executes when Unix first boots up. The startup scripts are in directory /etc/init.d
cd /etc/init.d
find . -name "*" | xargs grep apex
The output is
./oracle: su - oracle -c "/home/oracle/apexlistener.sh start"
./oracle: su - oracle -c "/home/oracle/apexlistener.sh stop"
Reading the file ./oracle with the command
more ./oracle
shows me how to stop and start Oracle Apex.
No comments:
Post a Comment