Wednesday, February 20, 2008

Find out if something is running on port 8080

For my remote NMI builds, there is a problem I am facing that the portal I am building won't start on port 8080 because it is "being used by" something else.

Here's a test you can perform automatically to verify if the port is indeed being blocked, and by what (use the "lsof" command). By the way this doesn't actually help me any for my NMI builds since the NMI machines don't have the "lsof" command.

echo -------- IS THE TOMCAT PORTAL ALREADY RUNNING, OR IS PORT 8080 BEING USED? ---------
# COMMAND TO FIND OUT WHAT IS RUNNING ON PORT 8080
lsof -i :8080


if test $? -ne 0; then
echo " => PORT 8080 IS FREE, NO PROBLEMO"
else
echo " => PORT 8080 IS BLOCKED, TRY SHUTTING DOWN TOMCAT SERVER"
portal_deploy/apache-tomcat-5.5.12/bin/shutdown.sh
fi

echo ------------------------------------------------------------------------------------

No comments: