karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch master updated: [KARAF-6290] Enhance wrapper pid management on Solaris
Date Tue, 28 May 2019 14:56:12 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 3055768  [KARAF-6290] Enhance wrapper pid management on Solaris
3055768 is described below

commit 3055768c9a9ea60aaff7b2710d943f4b23e9af44
Author: Baptiste DA ROIT <baptiste.daroit@aspera.com>
AuthorDate: Tue May 28 16:05:16 2019 +0200

    [KARAF-6290] Enhance wrapper pid management on Solaris
---
 .../karaf/wrapper/internal/unix/karaf-service      | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
b/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
index 7defa82..0e66e00 100644
--- a/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
+++ b/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
@@ -367,12 +367,37 @@ getpid() {
                 if [ "$DIST_OS" = "solaris" ]
                 then
                     pidtest=`$PSEXE -p $pid -o comm | grep $WRAPPER_CMD | tail -1`
+                    # On Solaris, standard ps is truncated so even if pid is running, pidtest

+                    # can be empty when path to wrapper exe is too long 
+                    if [ "X$pidtest" = "X" ]
+                    then 
+                        # Using pargs and /usr/ucb/ps thus allows to secure pid check  
+                        PARGSEXE="`command -v pargs 2>/dev/null`"
+                        if [ "X$PARGSEXE" != "X" ]
+                        then
+                            pidtest=`$PARGSEXE $pid | grep $WRAPPER_CMD | tail -1 | awk '{print
$2}'`
+                        fi
+                        if [ "X$pidtest" = "X" ]
+                        then
+                            if [ -x "/usr/ucb/ps" ]
+                            then 
+                                pidtest=`/usr/ucb/ps -axwww $pid | grep $WRAPPER_CMD | tail
-1 | awk '{print $5}'`  
+                            fi
+                        fi
+                    fi
                 elif [ "$DIST_OS" = "aix" ]
                 then
                     pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
                 elif [ "$DIST_OS" = "hpux" ]
                 then
                     pidtest=`UNIX95= $PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail
-1`
+                    # Such as on Solaris, standard ps is truncated on HP-UX so even if pid
is running, pidtest
+                    # can still be empty when path to wrapper exe is too long
+                    if [ "X$pidtest" = "X" ]
+                    then
+                        # On latest HP-UX platforms, -x option has been added to allow printing
full command args
+                        pidtest=`$PSEXE -p $pid -x 2>/dev/null | grep "$WRAPPER_CMD" |
tail -1 | awk '{print $4}'`
+                    fi
                 else
                     pidtest=`$PSEXE -p $pid -o command | grep $WRAPPER_CMD | tail -1`
                 fi


Mime
View raw message