You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2014/07/26 03:52:27 UTC

[45/50] git commit: [KARAF-3042] Add KARAF_REDIRECT variable to control if and where the std/err output are redirected

[KARAF-3042] Add KARAF_REDIRECT variable to control if and where the std/err output are redirected

Conflicts:
	assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/2c4442ca
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/2c4442ca
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/2c4442ca

Branch: refs/remotes/karaf-2.3.x
Commit: 2c4442ca8a61093b2fc09c850451c7399c9f4453
Parents: 9291835
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Jul 23 22:07:05 2014 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Jul 23 22:19:11 2014 +0200

----------------------------------------------------------------------
 .../src/main/distribution/unix-shell/bin/setenv        |  2 +-
 .../src/main/distribution/unix-shell/bin/start         | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/2c4442ca/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/setenv
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/setenv b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/setenv
index 337d8c0..0625634 100755
--- a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/setenv
+++ b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/setenv
@@ -43,4 +43,4 @@
 # export KARAF_DATA # Karaf data folder
 # export KARAF_BASE # Karaf base folder
 # export KARAF_OPTS # Additional available Karaf options
-
+# export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start

http://git-wip-us.apache.org/repos/asf/karaf/blob/2c4442ca/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start
index a4eab73..34b6f2c 100755
--- a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start
+++ b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/start
@@ -98,6 +98,14 @@ locateData() {
     fi
 }
 
+enableRedirect() {
+    if [ "x$KARAF_REDIRECT" != "x" ]; then
+	warn "Redirecting Karaf output to $KARAF_REDIRECT"
+    else
+	KARAF_REDIRECT="/dev/null"
+    fi
+}
+
 init() {
     # Determine if there is special OS handling we must perform
     detectOS
@@ -110,6 +118,9 @@ init() {
 
     # Locate the Karaf data directory
     locateData
+
+    # Define the Karaf output redirection
+    enableRedirect
 }
 
 run() {
@@ -123,7 +134,7 @@ run() {
     if [ ! -d "$KARAF_DATA/log" ]; then
         mkdir -p "$KARAF_DATA/log"
     fi
-    exec "$KARAF_HOME"/bin/karaf server "$@" >> "$KARAF_DATA/karaf.out" 2>&1 &
+    exec "$KARAF_HOME"/bin/karaf server "$@" >> "$KARAF_REDIRECT" 2>&1 &
 }
 
 main() {