Changeset 32049
- Timestamp:
- 2017-10-20T15:50:51+13:00 (6 years ago)
- Location:
- main/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r31884 r32049 415 415 if (GS3) { // issue the ant call to stop any running GS3 416 416 // (tomcat and networked Derby Server) by calling GS3ServerThread.stopServer() 417 GS3ServerThread.stopServer(); 417 if(!GS3ServerThread.wasServerLaunchedOutsideGLI()) { 418 GS3ServerThread.stopServer(); 419 } else { 420 System.err.println("@@@ Tomcat was launched outside GLI. Leaving it running..."); 421 } 418 422 } else { // issue the call to stop any running GS2 local library server 419 423 if (LocalLibraryServer.isRunning() == true) { … … 431 435 } 432 436 else { // local GS3, start the local tomcat 433 437 438 if(!GS3ServerThread.wasServerLaunchedOutsideGLI()) { 439 System.err.println("@@@@ Launching tomcat from GLI"); 434 440 GS3ServerThread thread = new GS3ServerThread(gsdl3_src_path, "restart"); 435 441 thread.start(); 436 437 438 442 } 443 439 444 // If fedora installed inside this local GS3, then ask for fedora login details now. 440 445 if (fedora_info.isActive()) { … … 814 819 //GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl_path, "stop"); 815 820 //thread.start(); 816 817 GS3ServerThread.stopServer(); 821 if(!GS3ServerThread.wasServerLaunchedOutsideGLI()) { 822 System.err.println("@@@@ Off to call stopServer"); 823 GS3ServerThread.stopServer(); 824 } else { 825 System.err.println("@@@ Tomcat was launched outside GLI. Leaving it running..."); 826 } 818 827 819 828 } -
main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java
r31593 r32049 48 48 String _gsdl3_src_path = ""; 49 49 String _ant_command = ""; 50 51 // isIndependentServer is true/1 if tomcat was already running when GLI was started up 52 // in which case GLI doesn't need to ask tomcat to be run, nor does it need to stop the server on exit 53 // Value can be -1, 0 or 1. -1 means not yet determined. 0 is false, 1 is true 54 static private final boolean isIndependentServer = GS3ServerThread.isServerRunning(); 55 56 /*static { 57 isIndependentServer = isServerRunning(); 58 }*/ 50 59 51 60 public GS3ServerThread(String gsdl3_src_path, String ant_command) 52 61 { 53 62 _gsdl3_src_path = gsdl3_src_path; 54 _ant_command = ant_command; // "restart" 63 _ant_command = ant_command; // "restart" 55 64 } 56 65 … … 145 154 146 155 } 156 157 public static boolean isServerRunning() { 158 String antCmd = "ant verbose-check-tomcat-running"; 159 160 SafeProcess p = null; 161 if (Utility.isWindows()) { 162 // cmd /C "cd "C:\path\to\greenstone3" && ant stop" 163 p = new SafeProcess("cmd /C \"cd \"" + Configuration.gsdl3_src_path + File.separator + "\" && "+antCmd+"\""); 164 } else { 165 p = new SafeProcess(new String[]{"/bin/bash", "-c", antCmd+" -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""}); 166 } 167 168 System.err.println("**** Checking if tomcat is running"); 169 p.runProcess(); 170 String output = p.getStdOutput(); 171 172 if(output.contains("Tomcat is running: true")) { 173 System.err.println("**** Tomcat was running"); 174 return true; 175 } 176 177 System.err.println("**** Tomcat was not running"); 178 return false; 179 } 180 181 // first time, call this on startup, before running GS3ServerThread 182 public static boolean wasServerLaunchedOutsideGLI() { 183 System.err.println("@@@ Was server launched outside GLI: " + isIndependentServer); 184 return isIndependentServer; 185 } 147 186 } -
main/trunk/greenstone3/build.xml
r31508 r32049 1724 1724 </condition> 1725 1725 </target> 1726 1727 <!-- 1728 <target name="verbose-check-tomcat-running"> 1729 <condition property="tomcat.isrunning" value="true" else="false"> 1730 <http url="${server.protocol}://${tomcat.server}:${tomcat.port}"/> 1731 </condition> 1732 <echo>Tomcat is running: ${tomcat.isrunning}</echo> 1733 </target> 1734 --> 1735 <target name="verbose-check-tomcat-running" depends="check-tomcat-running"> 1736 <if> 1737 <bool> 1738 <istrue value="${tomcat.isrunning}"/> 1739 </bool> 1740 <echo>Tomcat is running: ${tomcat.isrunning}</echo> 1741 <else><echo>Tomcat is running: false</echo></else><!-- tomcat.isrunning not set --> 1742 </if> 1743 </target> 1726 1744 1727 1745 <!-- Need a copy of the check-tomcat-running target with a distinct property, because ant restart runs
Note:
See TracChangeset
for help on using the changeset viewer.