|
@ -48,8 +48,7 @@ public class UpdateThread implements Runnable {
|
|
|
if (!StringUtils.isEmpty(filePath)) {
|
|
|
//关闭服務
|
|
|
closeService();
|
|
|
//睡眠五秒
|
|
|
Thread.sleep(1000 * 60);
|
|
|
//睡眠8秒
|
|
|
//解压
|
|
|
if (zipFile(filePath)) {
|
|
|
//启动服务
|
|
@ -166,10 +165,30 @@ public class UpdateThread implements Runnable {
|
|
|
}
|
|
|
fis.close();
|
|
|
br.close();
|
|
|
//判断是否服务是否关闭
|
|
|
while (true) {
|
|
|
String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
|
|
|
Process ps = Runtime.getRuntime().exec(batPath);
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
InputStream os = ps.getInputStream();
|
|
|
byte b[] = new byte[256];
|
|
|
while (os.read(b) > 0)
|
|
|
baos.write(b);
|
|
|
String s = baos.toString();
|
|
|
System.out.println(s);
|
|
|
os.close();
|
|
|
baos.close();
|
|
|
if (Boolean.valueOf(s.trim())) {
|
|
|
break;
|
|
|
}
|
|
|
Thread.sleep(800L);
|
|
|
}
|
|
|
} else {
|
|
|
LogUtil.info("重启linux服务");
|
|
|
Runtime.getRuntime().exec("service " + ThreadConfig.TOMCAT_SERVICENAME + " stop");
|
|
|
Thread.sleep(6000L);
|
|
|
}
|
|
|
|
|
|
LogUtil.info("关闭成功");
|
|
|
} catch (Exception e) {
|
|
|
LogUtil.error("关闭失败:" + e.getMessage());
|
|
@ -323,10 +342,11 @@ public class UpdateThread implements Runnable {
|
|
|
return folderPath + fileName + ".war";
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
getProcess();
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public static boolean getProcess() {
|
|
|
boolean flag = false;
|
|
|
try {
|