停止服务改成重启服务
maven新增打包到服务端功能(需映射nas路径到z盘)
This commit is contained in:
@@ -3,8 +3,40 @@ package com.yutou.nas.utils;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.yutou.nas.utils.RedisTools.processOut;
|
||||
|
||||
public class AppTools {
|
||||
public static String getToDayNowTimeToString(){
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
public static String getToDayNowTimeToString() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
}
|
||||
|
||||
public static void exec(String exec) {
|
||||
try {
|
||||
Process process;
|
||||
if (AppTools.isRuntimeSystemOfWindow()) {
|
||||
process = Runtime.getRuntime().exec(new String[]{
|
||||
"cmd",
|
||||
"/c",
|
||||
exec
|
||||
}
|
||||
);
|
||||
} else {
|
||||
process = Runtime.getRuntime().exec(new String[]{
|
||||
"sh",
|
||||
"-c",
|
||||
exec
|
||||
}
|
||||
);
|
||||
}
|
||||
processOut(process.getInputStream());
|
||||
processOut(process.getErrorStream());
|
||||
process.destroy();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRuntimeSystemOfWindow() {
|
||||
return System.getProperty("os.name").contains("Windows");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user