public static Process execCommandLineUtility(String cmd, OutputStream out, OutputStream err) { return execCommandLineUtility(new String[] {cmd}, out, err); }
public static Process execCommandLineUtility(String cmd, OutputStream out, OutputStream err) { return execCommandLineUtility(new String[] {cmd}, out, err); }
public static Process execCommandLineUtility(String cmd) { return execCommandLineUtility(cmd, System.out, null); }
public static Process execCommandLineUtility(String cmd) { return execCommandLineUtility(cmd, System.out, null); }
public static Process execCommandLineUtility(String[] cmd) { return execCommandLineUtility(cmd, System.out, null); }
public static Process execCommandLineUtility(String[] cmd) { return execCommandLineUtility(cmd, System.out, null); }
public static void execute(String... cmd) { String osName = System.getProperty("os.name"); if (!osName.startsWith("Windows")) { // needed for the Fedora shell scripts cmd[0] = cmd[0] + ".sh"; } if (sbOut != null && sbErr != null) { sbOut.reset(); sbErr.reset(); ExecUtility.execCommandLineUtility(cmd, sbOut, sbErr); } else { ExecUtility.execCommandLineUtility(cmd); } }
private void startTomcat() throws Exception { String cmd = Constants.FEDORA_HOME + "/tomcat/bin/startup"; if (!osName.startsWith("Windows")) { cmd += ".sh"; } ExecUtility.execCommandLineUtility(cmd); System.out.print("Starting Tomcat "); int count = 0; int timeout = 1000 * 30; while (!isFedoraRunning()) { System.out.print("."); Thread.sleep(1000); count += 1000; if (count > timeout) { throw new RuntimeException("Tomcat startup timeout"); } } System.out.println(); }
private void shutdownTomcat() throws Exception { if (!isTomcatRunning()) { System.out.println("Tomcat was already shut down."); return; } String cmd = Constants.FEDORA_HOME + "/tomcat/bin/shutdown"; String osName = System.getProperty("os.name"); if (!osName.startsWith("Windows")) { cmd += ".sh"; } System.out.print("Shutting down Tomcat "); ExecUtility.execCommandLineUtility(cmd); int count = 0; int timeout = 1000 * 30; while (isTomcatRunning()) { System.out.print("."); Thread.sleep(1000); count += 1000; if (count > timeout) { throw new RuntimeException("Tomcat shutdown timeout"); } } Thread.sleep(5000); System.out.println(); }