From 76e328a7b8a73d1c97ae511054a1b25e6c81f433 Mon Sep 17 00:00:00 2001 From: idfx Date: Sun, 16 Sep 2001 16:25:57 +0000 Subject: [PATCH] rsync configureable --- source/config.properties-dist | 7 ++++++- source/mir/misc/Helper.java | 11 ++++++++--- source/mircoders/servlet/ServletModuleOpenIndy.java | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/config.properties-dist b/source/config.properties-dist index c3b1ad0b..16dea491 100755 --- a/source/config.properties-dist +++ b/source/config.properties-dist @@ -7,6 +7,11 @@ HTMLTemplateProcessor.DocRoot=/idfx ClearXslCache=no DirectOpenposting=yes + +#use rsync to mirror the website to a remote-host +Rsync=no +Rsync.Script.Path=/var/www/bin/rsync-copy + StandardLanguage=de # the directory where the html-files will be saved @@ -243,4 +248,4 @@ Xsl.TopicList=producer/topic.xsl Xsl.OpenList=producer/open.xsl Xsl.Wap=producer/wml2.xsl -Sync.Script.Path=/var/www/bin/rsync-copy + diff --git a/source/mir/misc/Helper.java b/source/mir/misc/Helper.java index bbfb8426..0dad6902 100755 --- a/source/mir/misc/Helper.java +++ b/source/mir/misc/Helper.java @@ -17,13 +17,18 @@ public class Helper { * rsync the webrepository * needs a rsyncscript * returns the exit-code + * returns 255 if rsync should not be used */ public static int rsync(){ - Process p; + if(!Configuration.getProperty("Rsync").toLowerCase().equals("yes")){ + return 255; + } + + Process p; int returnValue = -1; try { Runtime run = Runtime.getRuntime(); - p = run.exec(Configuration.getProperty("Sync.Script.Path")); + p = run.exec(Configuration.getProperty("Rsync.Script.Path")); returnValue = p.waitFor(); } catch (IOException e) { return returnValue; @@ -32,4 +37,4 @@ public class Helper { } return returnValue; } -} \ No newline at end of file +} diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java index 3c218d51..8bec930e 100755 --- a/source/mircoders/servlet/ServletModuleOpenIndy.java +++ b/source/mircoders/servlet/ServletModuleOpenIndy.java @@ -103,6 +103,7 @@ public class ServletModuleOpenIndy extends ServletModule // sync the server int exitValue = Helper.rsync(); + theLog.printDebugInfo("rsync:"+exitValue); // redirecting to url // should implement back to article @@ -234,6 +235,7 @@ public class ServletModuleOpenIndy extends ServletModule // sync the server //should be configureable int exitValue = Helper.rsync(); + theLog.printDebugInfo("rsync: "+exitValue); } catch (IOException e) { throw new ServletModuleException(e.toString());} -- 2.11.0