Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x 7f00332c0 -> 5fe179197


[KARAF-3996] Update karaf script to be able to use custom MAX_FD


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

Branch: refs/heads/karaf-2.x
Commit: 5fe1791979389c50d8716087d1cb02a2a85329a7
Parents: 7f00332
Author: Jean-Baptiste Onofré <[email protected]>
Authored: Fri Sep 25 07:52:43 2015 +0200
Committer: Jean-Baptiste Onofré <[email protected]>
Committed: Fri Sep 25 07:52:43 2015 +0200

----------------------------------------------------------------------
 .../src/main/distribution/unix-shell/bin/karaf  | 24 +++++++++-----------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/5fe17919/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/karaf
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/karaf 
b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/karaf
index f5a1bc6..ce50dd7 100755
--- a/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/karaf
+++ b/assemblies/apache-karaf/src/main/distribution/unix-shell/bin/karaf
@@ -91,24 +91,22 @@ unlimitFD() {
 
     # Increase the maximum file descriptors if we can
     if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
-        MAX_FD_LIMIT=`ulimit -H -n`
-        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+            MAX_FD_LIMIT=`ulimit -H -n`
             if [ $? -eq 0 ]; then
-                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-                    # use the system max
-                    MAX_FD="$MAX_FD_LIMIT"
-                fi
-
-                ulimit -n $MAX_FD > /dev/null
-                # echo "ulimit -n" `ulimit -n`
-                if [ $? -ne 0 ]; then
-                    warn "Could not set maximum file descriptor limit: $MAX_FD"
-                fi
+                # use the system max
+                MAX_FD="$MAX_FD_LIMIT"
             else
                 warn "Could not query system maximum file descriptor limit: 
$MAX_FD_LIMIT"
             fi
         fi
-    fi
+        if [ "$MAX_FD" != 'unlimited' ]; then
+            ulimit -n $MAX_FD > /dev/null
+            if [ $? -ne 0 ]; then
+                warn "Could not set maximum file descriptor limit: $MAX_FD"
+            fi
+        fi
+     fi
 }
 
 locateHome() {

Reply via email to