开发者

Check if port is open in ANT

开发者 https://www.devze.com 2023-03-16 05:54 出处:网络
Is it possible to check whether a port开发者_JAVA百科 is open using ANT tasks? I need to execute flexunit task, but before I start this task I need to check if another flexunit task is not running an

Is it possible to check whether a port开发者_JAVA百科 is open using ANT tasks?

I need to execute flexunit task, but before I start this task I need to check if another flexunit task is not running and blocking the desired port.

Thank you for any suggestions,

Rafal


Use the ant socket condition.

<target name="check-port" description="Check whether Tomcat is running">
    <echo message="Checking whether Tomcat is running"/>
    <condition property="tomcat.running">
      <socket server="${tomcat.host}" port="${tomcat.port}"/> 
    </condition>
</target>

http://ant.apache.org/manual/Tasks/conditions.html

0

精彩评论

暂无评论...
验证码 换一张
取 消