Skip to content

Commit

Permalink
next try to fix the restart
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3939 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 29, 2007
1 parent 2ff94b2 commit 08d5db6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions source/de/anomic/yacy/yacyVersion.java
Expand Up @@ -41,7 +41,6 @@
import de.anomic.http.httpc;
import de.anomic.net.URL;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverFileUtils;
import de.anomic.server.serverSystem;
import de.anomic.server.logging.serverLog;
Expand Down Expand Up @@ -288,18 +287,25 @@ public static void restart() {
if (serverSystem.canExecUnix) {
// start a re-start daemon
try {
String script = "#!/bin/sh" + serverCore.crlfString + "cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + "/DATA/RELEASE/;while [ -e ../yacy.running ]; do sleep 1;done;cd ../../;./startYACY.sh";
serverLog.logInfo("RESTART", "INITIATED");
String script = "cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + "/DATA/RELEASE/;while [ -e ../yacy.running ]; do sleep 1;done;cd ../../;./startYACY.sh";
File scriptFile = new File(plasmaSwitchboard.getSwitchboard().getRootPath(), "DATA/RELEASE/restart.sh");
serverFileUtils.write(script.getBytes(), scriptFile);
Process p = Runtime.getRuntime().exec("/bin/sh chmod 755 " + scriptFile.getAbsolutePath() + ";" + scriptFile.getAbsolutePath() + " &");
serverLog.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
Runtime.getRuntime().exec("chmod 755 " + scriptFile.getAbsolutePath()).waitFor();
/*Process p =*/ Runtime.getRuntime().exec(scriptFile.getAbsolutePath() + " &");
/*serverLog.logInfo("RESTART", "script started");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String text;
while ((text = in.readLine()) != null) {
serverLog.logInfo("RESTART", " -- " + text);
}
serverLog.logInfo("RESTART", " SCRIPT-LOG " + text);
}*/
serverLog.logInfo("RESTART", "script is running");
plasmaSwitchboard.getSwitchboard().terminate(5000);
} catch (IOException e) {
serverLog.logSevere("RESTART", "restart failed", e);
} catch (InterruptedException e) {
serverLog.logSevere("RESTART", "restart failed", e);
}
}
}
Expand Down

0 comments on commit 08d5db6

Please sign in to comment.