|
@ -201,9 +201,9 @@ public class UpdateThread implements Runnable {
|
|
|
try {
|
|
|
String system = System.getProperty("os.name").toLowerCase();
|
|
|
if (system.contains("windows")) {
|
|
|
LogUtil.info("启动windows服务");
|
|
|
//windows
|
|
|
String batPathStart = UpdateThread.class.getResource("/").getPath() + "config/start.bat";
|
|
|
LogUtil.info("启动windows服务:" + batPathStart);
|
|
|
//windows
|
|
|
Process psStart = Runtime.getRuntime().exec(batPathStart);
|
|
|
ByteArrayOutputStream baosStart = new ByteArrayOutputStream();
|
|
|
InputStream osStart = psStart.getInputStream();
|
|
@ -213,8 +213,9 @@ public class UpdateThread implements Runnable {
|
|
|
}
|
|
|
osStart.close();
|
|
|
baosStart.close();
|
|
|
int i = 0;
|
|
|
LogUtil.info("开始判断服务是否启动");
|
|
|
while (true) {
|
|
|
int i = 0;
|
|
|
String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
|
|
|
Process ps = Runtime.getRuntime().exec(batPath);
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
@ -225,13 +226,13 @@ public class UpdateThread implements Runnable {
|
|
|
String s = baos.toString();
|
|
|
os.close();
|
|
|
baos.close();
|
|
|
LogUtil.info("服务正在启动:" + Boolean.valueOf(s.trim()));
|
|
|
if (Boolean.valueOf(s.trim())) {
|
|
|
i++;
|
|
|
if (i > 3) {
|
|
|
LogUtil.info("服务启动成功");
|
|
|
break;
|
|
|
}
|
|
|
LogUtil.info("第" + i + "次判断服务已经启动");
|
|
|
Thread.sleep(1000L);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@ -373,6 +374,7 @@ public class UpdateThread implements Runnable {
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
while (true) {
|
|
|
String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
|
|
|
System.out.println(batPath);
|
|
|
Process ps = Runtime.getRuntime().exec(batPath);
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
InputStream os = ps.getInputStream();
|