停止服务改成重启服务
maven新增打包到服务端功能(需映射nas路径到z盘)
This commit is contained in:
parent
c326e22699
commit
96f560e3c9
21
pom.xml
21
pom.xml
@ -158,6 +158,27 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!--使用-Dloader.path需要在打包的时候增加<layout>ZIP</layout>,不指定的话-Dloader.path不生效-->
|
||||
<layout>ZIP</layout>
|
||||
<!-- 指定该jar包启动时的主类[建议] -->
|
||||
<mainClass>com.yutou.nas.NasApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
|
||||
<configuration>
|
||||
<outputDirectory>
|
||||
Z:\servier\tools\
|
||||
</outputDirectory>
|
||||
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class QQBotManager {
|
||||
|
||||
private static class QQCommands {
|
||||
private final static String QQ_HELP = "!help";
|
||||
private final static String QQ_SYSTEM_STOP = "!stop";
|
||||
private final static String QQ_SYSTEM_RESTART = "!restart";
|
||||
private final static String QQ_UPDATE_IP = "!更新ip";
|
||||
private final static String QQ_GET_IP = "!ip";
|
||||
private final static String QQ_OPEN_PC = "!开机";
|
||||
@ -95,7 +95,7 @@ public class QQBotManager {
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String str = sendMessage("姬妻酱上线拉~");
|
||||
String str = sendMessage("姬妻酱上线拉~☆Daze~");
|
||||
com.yutou.nas.utils.Log.i(str);
|
||||
|
||||
}
|
||||
@ -259,10 +259,10 @@ public class QQBotManager {
|
||||
case QQCommands.QQ_BT_RELOAD:
|
||||
BTDownloadManager.getInstance().start();
|
||||
break;
|
||||
case QQCommands.QQ_SYSTEM_STOP:
|
||||
getInstance().sendMessage("正在停止服务");
|
||||
case QQCommands.QQ_SYSTEM_RESTART:
|
||||
getInstance().sendMessage("正在重启服务");
|
||||
System.out.println("结束进程");
|
||||
System.exit(0);
|
||||
AppTools.exec("cd /media/yutou/4t/public/servier/tools && ./start.sh");
|
||||
break;
|
||||
case QQCommands.QQ_HELP:
|
||||
builder = new StringBuilder();
|
||||
|
@ -290,7 +290,6 @@ public class RedisTools {
|
||||
}
|
||||
com.yutou.nas.utils.Log.i("cmd > " + str);
|
||||
QQBotManager.getInstance().sendMessage(str.toString());
|
||||
com.yutou.nas.utils.Log.i("线程结束");
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
RedisTools.pullMsg("msg", "abc");
|
||||
|
Loading…
Reference in New Issue
Block a user