停服日志输出

master
duhui 2021-06-22 10:21:57 +08:00
parent e568f2abc1
commit 49a85e2eb2
1 changed files with 8 additions and 3 deletions

View File

@ -20,6 +20,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -263,9 +265,12 @@ public class ServerInfoController {
}
String command = "sh " + path + " 210 " + serverInfo.getIP() + " " + serverInfo.getServer_id() + " " + serverInfo.getCoreName();
try {
wait = Runtime.getRuntime().exec(command).waitFor();
System.out.printf("删除操作完成:命令:{%s},结果{%d}\n",command,wait);
} catch (InterruptedException | IOException e) {
OutputStream stream = Runtime.getRuntime().exec(command).getOutputStream();
PrintStream printStream = new PrintStream(stream);
System.out.printf("删除操作完成:命令:{%s}\n",command);
printStream.println();
wait = 0;
} catch (IOException e) {
System.err.printf("删除操作失败:命令:{%s},报错:{%s}\n",command,e.getMessage());
e.printStackTrace();
}