- Timestamp:
- 2017-10-20T15:50:51+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.