[lug] How to tell if an app is running/port is in use?

Chip Atkinson chip at rmpg.org
Mon Mar 11 09:19:27 MST 2002


If you can find the port it's supposed to be listening on, either through
configs or knowing the hardcoded values, you can use
netstat -lnp
which shows the listening sockets and the PID/Program name.  This would
allow you to verify that the listener was at least java as well.
The -n option prevents lookups being done on IP addresses and socket
names.  Thus with -n, you'll see a 0.0.0.0:80 for a web server listening
for connections from anyone.  Without the -n, you'll see *:http.

Hope that helps.

Chip

On Mon, 11 Mar 2002, Alan Robertson wrote:

> Hi,
>
> I'm writing an System V init script for an app which doesn't have one.
>
> For the "status" case, I want to tell if the application is running.
>
> This is a little hard since the application doesn't appear to make any lock
> files, and is all in Java, so the ps always shows "java" as the process name.
>
> Another option would be to look and see if the app had it's ports open (it's
> a server which waits for clients to connect).
>
> What's the best way to do that?
>
> 	Thanks!
>
> 	-- Alan Robertson
> 	   alanr at unix.sh
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>




More information about the LUG mailing list