diff --git a/monitor/CheckServer/CheckServer.java b/monitor/CheckServer/CheckServer.java index 8f05a8a..06fcf14 100644 --- a/monitor/CheckServer/CheckServer.java +++ b/monitor/CheckServer/CheckServer.java @@ -12,6 +12,7 @@ public static void main(String[] args) { int port = Integer.parseInt(args[1]); int failCount = 0; + long lastrestarttime = 0; for (;;) { Socket socket = null; @@ -63,6 +64,14 @@ public static void main(String[] args) { failCount++; if (failCount >= 10) { + failCount = 0; + + if (lastrestarttime + 600000 > System.currentTimeMillis()) { + //If restarted in the last 10 minutes, give up. + //System.out.println("CheckServer: I give up!"); + break; //We break so that finally is still run. + } + lastrestarttime = System.currentTimeMillis(); try { //System.out.println("Restart"); String command[] = { "/bin/bash", "service", "minecraft", "restart" };