2011-04-14 3 views
2

바보 같은 문제가 붙어 있어요. 문제는 다음과 같습니다.개미 박쥐 파일을 실행하고 앞으로 이동

독점적 인 자체 제작 서버를 시작해야합니다. 이 서버는 .bat 파일을 사용하여 시작됩니다 (Windows OS).

  1. <exec /> start-stupid-server.bat
  2. <waitfor /> 서버 포트 :

    가 나는 Ant 대상을 작성했습니다.

따라서 박쥐 파일이 실행되면 서버는 포트를 수신합니다. Ant는 BUILD SUCCESSFUL을 쓰고 종료하지 않습니다. Ant는 서버 창이 닫힐 때까지 기다립니다. 나는 그것을 극복하기 위해 100,500 가지 방법을 시도했지만 성공하지 못했습니다. <exec /> 박쥐 파일에 대한 개미에 방법이 있습니까? 잊어 버리시겠습니까?

<exec spawn="true" /> Ant가 서버 창을 닫고 서버가 종료되기 때문에 도움이되지 않습니다.

내가 가진 <exec /> 시도했습니다. 여기

<target name="start_proprietary_server" depends="bootstrap"> 
    <echo message="going to stop MDM server instance... "/> 
    <forget daemon="true"> 
     <exec executable="${app.custom.root}/bin/stopAll.bat" dir="${app.custom.root}/bin" /> 
    </forget> 
    <waitfor 
      maxwait="20" maxwaitunit="second" 
      checkevery="1" checkeveryunit="second" timeoutproperty="mdm.stop.error"> 
     <and> 
      <not> <socket server="localhost" port="12000" /> </not> 
      <not> <socket server="localhost" port="14444" /> </not> 
     </and> 
    </waitfor> 

    <if> 
     <isset property="mdm.stop.error" /> 
     <then> 
      <echo message="There are some problems while stopping MDM server. See what's went wrong" /> 
     </then> 
     <else> 
      <echo message="MDM server successfully stoped." /> 
     </else> 
    </if> 

    <echo message="going to start MDM server instance... "/> 

    <!-- 
     Starts but doesn't exit target 
     <exec executable="cmd" dir="${app.custom.root}/bin" > 
      <arg value="/c start startAll.bat" /> 
     </exec> 
    --> 

    <!-- 
     <forget daemon="true"> 
      <exec executable="cmd" dir="" > 
       <arg value="/c startAll.bat" /> 
      </exec> 
     </forget> 
    --> 

    <forget daemon="true"> 
     <exec executable="${app.custom.root}/bin/startAll.bat" dir="${app.custom.root}/bin" /> 
    </forget> 


    <echo message="Wating for localhost ports #12000 and #14444"/> 
    <waitfor 
      maxwait="40" maxwaitunit="second" 
      checkevery="3" checkeveryunit="second" timeoutproperty="mdm.start.error"> 
     <and> 
      <socket server="localhost" port="12000" /> 
      <socket server="localhost" port="14444" /> 
     </and> 
    </waitfor> 

    <if> 
     <isset property="mdm.start.error" /> 
     <then> 
      <echo message="There are some problems while starting MDM server. See what's went wrong" /> 
     </then> 
     <else> 
      <echo message="MDM server has been started." /> 
     </else> 
    </if> 
</target> 

입니다 :

start start-stupid-server.bat, 
start /b start-stupid-server.bat 

아무것도 도움이되지 :(서버 창이 닫힐 때까지 개미는 여전히 대기를 여기

내 대상 박쥐 파일 :

call .\bcmenv.bat 
start /min .\startLocator.bat 
sleep 5 

start /min .\startServices.bat 
exit 

start, start /bcall을 사용하여 forget 태그를 사용하여 실행하려고했지만 아무 도움이되지 않습니다. Ant는 서버 창이 닫힐 때까지 작업을 완료하지 않습니다.

forget없이 스폰를 사용하는 경우 Ant는 대상을 종료 할 때 서버 창을 닫습니다. 그것은 forget과 함께 스폰를 사용합니다. Ant 대상은 서버 창이 닫힐 때까지 완료되지 않습니다.

다음에 시도 할 수있는 항목은 무엇입니까?

start <path_to_server_bat> <args> 

당신이 spawn=true를 시도 :

+0

자세한 정보를 제공해 줄 수 있습니까? 아마도 배치 파일을 보는 것이 도움이 될 것입니다. – Brad

+0

안녕하세요, Brad. 문제에 대한 추가 정보를 추가했습니다. 나는 피곤했다 : 쉘 스크립트, 임원, 전화, 시작 ... 잊지 마라. Ant는 독점적 인 start_server.bat가 종료 될 때까지 대상을 완료하지 않습니다. – Sergey

답변

0

즉시 start 명령을 사용하여 서버를 시작하고 반환하는 다른 배치 파일을 만들 수 있습니까?

관련 문제