Ignore:
Timestamp:
2012-03-30T20:00:47+13:00 (12 years ago)
Author:
ak19
Message:
  1. added force-stop-tomcat target which does what the old stop-tomcat target did. The current stop-tomcat target calls force-stop-tomcat only if tomcat is already running. 2. The config-admin target is modified to also test for an already running tomcat and only stops and restarts it in such a case.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r25314 r25321  
    11081108  <!-- windows: do we want to launch a webrowser?? -->
    11091109  <!-- shouldn't this test whether anything is running first? -->
    1110   <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
     1110  <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
    11111111    <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
    11121112      <env key="CATALINA_HOME" value="${catalina.home}"/>
     
    11161116    </exec>
    11171117  </target>
     1118
     1119  <target name="check-tomcat-running">
     1120    <!--can also try the "socket" condition in place of the "http" condition-->
     1121    <condition property="tomcat.isrunning"><!--<waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped">-->
     1122      <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/> <!--host:port/greenstone3-->
     1123    </condition><!--</waitfor>-->
     1124  </target>
     1125
     1126  <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
     1127     <antcall target="force-stop-tomcat"/>
     1128  </target>
     1129
    11181130
    11191131  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
     
    12231235      <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
    12241236    </input>
    1225     <antcall target="stop-tomcat"/>
     1237
     1238    <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
     1239      See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html -->
     1240
     1241    <!--<antcall target="check-tomcat-running"/>--><!--won't set the tomcat.isrunning property for use below-->
     1242    <condition property="tomcat.isrunning">
     1243      <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/><!--can also try the "socket" condition in place of the "http" condition-->
     1244    </condition>
     1245    <if>
     1246      <bool>
     1247    <istrue value="${tomcat.isrunning}"/>
     1248      </bool>
     1249      <antcall target="force-stop-tomcat"/>
     1250    </if>
     1251
    12261252    <!--<echo>${admin.password}</echo>--> <!-- for testing -->
    12271253    <java classname="org.greenstone.gsdl3.util.ChangePwdUsersDB">
     
    12311257      <arg value="${admin.password}"/>
    12321258    </java>
    1233     <antcall target="start-tomcat"/>
     1259
     1260    <!-- run tomcat again if it used to be running -->
     1261    <if>
     1262      <bool>
     1263    <istrue value="${tomcat.isrunning}"/>
     1264    </bool>
     1265      <antcall target="start-tomcat"/>
     1266    </if>
    12341267  </target>
    12351268
Note: See TracChangeset for help on using the changeset viewer.