This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: tomcat port check
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Feb 12, 2008
04:06 PM
tomcat port check
My installer will set up tomcat. It asks for your port number prior to updating server.xml (i.e. http://localhost:some_port). My installer needs to do a quick check to see if that port is in use (currently on Windows 2003 Server).
So, I create a "execute command" action that does 'netstat -an|find "$TOMCATPORT$"'. I store STDOUT from this command to another IA variable.
I then have a dialog that will display the port is in use (and a jump to take you back). I basically am saying if $STDOUT$ containst $TOMCATPORT$ - display this box, then jump back to the label.
I don't think the $TOMCATPORT is expanding within the find. I can see that $STDERR$ is set for my command.
Is there a way to pass the quotes to find?
Perhaps there is a better way to check if the port is in use? I wanted to avoid writing code if possible.
So, I create a "execute command" action that does 'netstat -an|find "$TOMCATPORT$"'. I store STDOUT from this command to another IA variable.
I then have a dialog that will display the port is in use (and a jump to take you back). I basically am saying if $STDOUT$ containst $TOMCATPORT$ - display this box, then jump back to the label.
I don't think the $TOMCATPORT is expanding within the find. I can see that $STDERR$ is set for my command.
Is there a way to pass the quotes to find?
Perhaps there is a better way to check if the port is in use? I wanted to avoid writing code if possible.
(2) Replies
‎Feb 12, 2008
09:42 PM
Google for "TCPView source" for tips on calling the API's that netstat calls for enumerating active listening tcp ports.
‎Feb 14, 2008
03:05 PM
Thanks. I'm trying to avoid any code specific to the installer at this point. However, I may have to write some tools like this.
For now, I am just calling "netstat -an" (and dropped the find ). I then have a screen to see if STDOUT from the call has the tomcat port the user typed in. Of course, this isn't perfect.
If they type in "123" for the port and netstat -an reports "12345" is in use, my test won't work. Given my time constraints, it's ok at this juncture.
For now, I am just calling "netstat -an" (and dropped the find ). I then have a screen to see if STDOUT from the call has the tomcat port the user typed in. Of course, this isn't perfect.
If they type in "123" for the port and netstat -an reports "12345" is in use, my test won't work. Given my time constraints, it's ok at this juncture.