You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/05/26 00:34:30 UTC

svn commit: r1342830 - /incubator/mesos/trunk/src/scripts/killtree.sh

Author: benh
Date: Fri May 25 22:34:30 2012
New Revision: 1342830

URL: http://svn.apache.org/viewvc?rev=1342830&view=rev
Log:
Better verbose output for killtree.sh (https://reviews.apache.org/r/5239).

Modified:
    incubator/mesos/trunk/src/scripts/killtree.sh

Modified: incubator/mesos/trunk/src/scripts/killtree.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/scripts/killtree.sh?rev=1342830&r1=1342829&r2=1342830&view=diff
==============================================================================
--- incubator/mesos/trunk/src/scripts/killtree.sh (original)
+++ incubator/mesos/trunk/src/scripts/killtree.sh Fri May 25 22:34:30 2012
@@ -117,8 +117,8 @@ if [[ ${?} -ne 0 ]]; then
 fi
 
 printpids() {
-  name="$1"
-  tpids="$2"
+  name="${1}"
+  tpids="${2}"
   if [[ ! -z ${tpids} ]]; then
       result=$(echo ${tpids} | xargs ps xo pid,ppid,pgid,sess,command -p)
       printf "\n${name}\n${result}\n"
@@ -132,7 +132,7 @@ killtree() {
 
     # Output pid if requested.
     if [[ ${VERBOSE} -eq 1 ]]; then
-        printpids "KILLPID" ${MYPID}
+        echo "Stopping ... ${MYPID}"
     fi
 
     # Stop the process to keep it from forking while we are killing it
@@ -161,7 +161,7 @@ killtree() {
     CHILDPIDS=$(ps axo ppid,pid | awk '{ if ($1 == '${MYPID}') print $2 }')
 
     if [[ ${VERBOSE} -eq 1 ]]; then
-        printpids "CHILDPIDS" "${CHILDPIDS}"
+        printpids "Children:" "${CHILDPIDS}"
     fi
 
     # Optionally collect all processes that are part of the process group.
@@ -177,7 +177,7 @@ killtree() {
                 | awk '{ if ($1 == '${MYPGID}') print $2 }')
 
 	    if [[ ${VERBOSE} -eq 1 ]]; then
-	        printpids "GROUPPIDS" "${GROUPPIDS}"
+	        printpids "Group members:" "${GROUPPIDS}"
 	    fi
 	fi
     fi
@@ -195,7 +195,7 @@ killtree() {
                 | awk '{ if ($1 == "'${MYPSID}'") print $2 }')
 
 	    if [[ ${VERBOSE} -eq 1 ]]; then
-                printpids "SESSPIDS" "${SESSPIDS}"
+                printpids "Session members:" "${SESSPIDS}"
 	    fi
 	fi
     fi
@@ -225,6 +225,10 @@ killtree() {
     # non-terminating but doesn't continue the process.
     kill -CONT ${MYPID} >/dev/null 2>&1
 
+    if [[ ${VERBOSE} -eq 1 ]]; then
+        echo "Sent signal to ${MYPID}"
+    fi
+
     for pid in ${NEW}; do
         killtree $pid
     done