From 54004e929ba2ba174a1ad609ca55d80889d842b8 Mon Sep 17 00:00:00 2001 From: low012 Date: Mon, 20 Aug 2007 21:52:52 +0000 Subject: [PATCH] *) Better Bourne-Shell (OpenSolaris) compatibility, update and restart really work now. As the Bourne-Shell is the grandfather of most modern shells, it should also work with Linux (tested with Mandriva, works) and OSX (Please test!). *) Fixed a typo. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4054 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Steering.html | 2 +- source/de/anomic/server/serverSystem.java | 4 ++-- source/de/anomic/yacy/yacyVersion.java | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htroot/Steering.html b/htroot/Steering.html index 22c039a6d..3da1099d6 100644 --- a/htroot/Steering.html +++ b/htroot/Steering.html @@ -26,7 +26,7 @@ If you can't reach YaCy's interface after 5 minutes restart failed. :: Installing release #[release]#
-

YaCy will be restartet after installation

+

YaCy will be restarted after installation

#(/info)#

diff --git a/source/de/anomic/server/serverSystem.java b/source/de/anomic/server/serverSystem.java index 916532c63..402951799 100644 --- a/source/de/anomic/server/serverSystem.java +++ b/source/de/anomic/server/serverSystem.java @@ -99,7 +99,7 @@ public final class serverSystem { isMacArchitecture = ((systemOS == systemMacOSC) || (systemOS == systemMacOSX)); isUnixFS = ((systemOS == systemMacOSX) || (systemOS == systemUnix)); - canExecUnix = ((isUnixFS) || (!((systemOS == systemMacOSC) || (systemOS == systemWindows)))); + canExecUnix = ((isUnixFS) || (!((systemOS == systemMacOSC) || (systemOS == systemWindows)))); // set up the MRJ Methods through reflection if (isMacArchitecture) try { @@ -340,7 +340,7 @@ public final class serverSystem { // runs a unix/linux script as separate thread File starterFile = new File(scriptFile.getAbsolutePath() + ".starter.sh"); //deployScript(starterFile, "touch restart.starter.startet1"); - deployScript(starterFile, scriptFile.getAbsolutePath() + " &" + serverCore.lfstring); + deployScript(starterFile, "#!/bin/sh" + serverCore.lfstring + scriptFile.getAbsolutePath() + " &" + serverCore.lfstring); try { Runtime.getRuntime().exec(starterFile.getAbsolutePath()).waitFor(); } catch (InterruptedException e) { diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java index 3cf182612..b86c0e36f 100644 --- a/source/de/anomic/yacy/yacyVersion.java +++ b/source/de/anomic/yacy/yacyVersion.java @@ -371,13 +371,14 @@ public final class yacyVersion implements Comparator, Comparable { try { serverLog.logInfo("RESTART", "INITIATED"); String script = + "#!/bin/sh" + serverCore.lfstring + "cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring + - "while [ -e ../yacy.running ]; do" + serverCore.lfstring + + "while [ -f ../yacy.running ]; do" + serverCore.lfstring + "sleep 1" + serverCore.lfstring + "done" + serverCore.lfstring + "cd ../../" + serverCore.lfstring + "nohup ./startYACY.sh > /dev/null" + serverCore.lfstring; - File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh"); + File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh"); serverSystem.deployScript(scriptFile, script); serverLog.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath()); serverSystem.execAsynchronous(scriptFile); @@ -395,9 +396,10 @@ public final class yacyVersion implements Comparator, Comparable { plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); serverLog.logInfo("UPDATE", "INITIATED"); String script = + "#!/bin/sh" + serverCore.lfstring + "cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring + "gunzip -c " + release + " | tar xf -" + serverCore.lfstring + - "while [ -e ../yacy.running ]; do" + serverCore.lfstring + + "while [ -f ../yacy.running ]; do" + serverCore.lfstring + "sleep 1" + serverCore.lfstring + "done" + serverCore.lfstring + "cp -Rf yacy/* ../../" + serverCore.lfstring +