Skip to content

Commit

Permalink
fixed a problem with restarts in YaCy mac applications: the DATA dire…
Browse files Browse the repository at this point in the history
…ctory path was not submitted when doing a restart. This solves the problem by:

- storing the startup properties when yacy is started
- using the properties in the restart-script again. this transports also the DATA directory location as parameter of the -gui option that is used when the Mac version of YaCy is started

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7102 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Sep 3, 2010
1 parent d4e4967 commit b3f0d06
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions source/de/anomic/yacy/yacyRelease.java
Expand Up @@ -71,6 +71,7 @@ public final class yacyRelease extends yacyVersion {
// for details see defaults/yacy.network.freeworld.unit
private static Map<yacyUpdateLocation, DevAndMainVersions> latestReleases = new ConcurrentHashMap<yacyUpdateLocation, DevAndMainVersions>();
public final static List<yacyUpdateLocation> latestReleaseLocations = new ArrayList<yacyUpdateLocation>(); // will be initialized with value in defaults/yacy.network.freeworld.unit
public static String startParameter = "";

private MultiProtocolURI url;
private File releaseFile;
Expand Down Expand Up @@ -394,7 +395,7 @@ public static void restart() {
final File startType = new File(sb.getDataPath(), "DATA/yacy.noconsole".replace("/", File.separator));
String starterFile = "startYACY_debug.bat";
if (startType.exists()) starterFile = "startYACY.bat"; // startType noconsole

if (startParameter.startsWith("-gui")) starterFile += " " + startParameter;
try{
Log.logInfo("RESTART", "INITIATED");
final String script =
Expand Down Expand Up @@ -449,7 +450,7 @@ public static void restart() {
"done" + serverCore.LF_STRING +
//"cd ../../" + serverCore.LF_STRING +
"cd " + sb.getAppPath() + serverCore.LF_STRING +
"nohup ./startYACY.sh > /dev/null" + serverCore.LF_STRING;
"nohup ./startYACY.sh " + (startParameter.startsWith("-gui") ? startParameter : "") + " > /dev/null" + serverCore.LF_STRING;
final File scriptFile = new File(sb.getDataPath(), "DATA/RELEASE/restart.sh");
OS.deployScript(scriptFile, script);
Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
Expand Down Expand Up @@ -484,6 +485,7 @@ public static void deployRelease(final File releaseFile) {
final File startType = new File(sb.getDataPath(), "DATA/yacy.noconsole".replace("/", File.separator));
String starterFile = "startYACY_debug.bat";
if (startType.exists()) starterFile = "startYACY.bat"; // startType noconsole
if (startParameter.startsWith("-gui")) starterFile += " " + startParameter;
script =
"@echo off" + serverCore.LF_STRING +
"title YaCy updater" + serverCore.LF_STRING +
Expand Down Expand Up @@ -531,7 +533,7 @@ public static void deployRelease(final File releaseFile) {
"cd " + sb.getAppPath().toString() + serverCore.LF_STRING +
"chmod 755 *.sh" + serverCore.LF_STRING + // tarTools does not keep access/execute right
"chmod 755 bin/*.sh" + serverCore.LF_STRING +
"nohup ./startYACY.sh > /dev/null" + serverCore.LF_STRING;
"nohup ./startYACY.sh " + (startParameter.startsWith("-gui") ? startParameter : "") + " > /dev/null" + serverCore.LF_STRING;
scriptFileName = "update.sh";
}
final File scriptFile = new File(sb.getDataPath(), "DATA/RELEASE/".replace("/", File.separator) + scriptFileName);
Expand Down
3 changes: 2 additions & 1 deletion source/net/yacy/yacy.java
Expand Up @@ -977,7 +977,8 @@ public static void main(String args[]) {
System.setProperty("java.awt.headless", "true");
}

System.out.print(">"); for (String a: args) System.out.print(a + " "); System.out.println();
String s = ""; for (String a: args) s += a + " ";
yacyRelease.startParameter = s.trim();

File applicationRoot = new File(System.getProperty("user.dir").replace('\\', '/'));
File dataRoot = applicationRoot;
Expand Down
5 changes: 3 additions & 2 deletions startYACY.sh
Expand Up @@ -95,8 +95,9 @@ for option in $options;do
-t|--tail-log)
TAILLOG=1
;;
-g|--gui)
-gui)
GUI=1
isparameter=1
;;
esac #case option
else #parameter
Expand Down Expand Up @@ -179,7 +180,7 @@ CLASSPATH=".:htroot:$CLASSPATH"
cmdline="$JAVA $JAVA_ARGS -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dfile.encoding=UTF-8 -classpath $CLASSPATH net.yacy.yacy";
if [ $GUI -eq 1 ] #gui
then
cmdline="$cmdline -gui"
cmdline="$cmdline -gui $parameter"
fi
if [ $DEBUG -eq 1 ] #debug
then
Expand Down

0 comments on commit b3f0d06

Please sign in to comment.