You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2019/06/11 17:33:44 UTC

[nifi-minifi-cpp] branch master updated: MINIFICPP-914: Incur wait while awaiting minifi shutdown during restart

This is an automated email from the ASF dual-hosted git repository.

phrocker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 1557d52  MINIFICPP-914: Incur wait while awaiting minifi shutdown during restart
1557d52 is described below

commit 1557d522eb09e7698a7ab65419b1b06f50193805
Author: Marc Parisi <ph...@apache.org>
AuthorDate: Mon Jun 10 13:44:55 2019 -0400

    MINIFICPP-914: Incur wait while awaiting minifi shutdown during restart
    
    This closes #589.
    
    Signed-off-by: Marc Parisi <ph...@apache.org>
---
 bin/minifi.sh | 42 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/bin/minifi.sh b/bin/minifi.sh
index 1a62838..68eb0b7 100755
--- a/bin/minifi.sh
+++ b/bin/minifi.sh
@@ -89,6 +89,12 @@ active_pid() {
   fi
 }
 
+endnow() {
+   echo "Killing MiNiFi..."
+   kill -9 ${saved_pid} > /dev/null 2>&1
+   
+}
+
 install() {
     detectOS
 
@@ -250,10 +256,23 @@ case "\$1" in
 		fi
         ;;
     restart)
-        echo Restarting MiNiFi service
-        \${bin_dir}/minifi.sh stop
-        \${bin_dir}/minifi.sh start
-        ;;
+      echo "Restarting the MiNiFi service. Hit CTRL+C at any time to forcibly terminate MiNiFi"
+      ${bin_dir}/minifi.sh stop
+      ticks=1
+      printf "Waiting for process to terminate."
+      trap endnow INT
+      if [ "${saved_pid}" -gt 0 ]; then
+        while [ $(active_pid ${saved_pid}) -eq 0 ]; do
+                sleep 1
+                ticks=$((ticks+1))
+                numticks=$(($ticks % 5))
+                if [ "${numticks}"  -eq 0 ]; then
+                        printf "."
+                fi
+        done
+      fi
+      ${bin_dir}/minifi.sh start
+	;;
     *)
         echo "Usage: service minifi {start|stop|restart|status}"
         ;;
@@ -362,8 +381,21 @@ case "$1" in
 		fi
         ;;
     restart)
-      echo Restarting MiNiFi service
+      echo "Restarting MiNiFi. Hit CTRL+C at any time to forcibly terminate MiNiFi"
       ${bin_dir}/minifi.sh stop
+      ticks=1
+      printf "Waiting for process to terminate."
+      trap endnow INT
+      if [ "${saved_pid}" -gt 0 ]; then
+      	while [ $(active_pid ${saved_pid}) -eq 0 ]; do
+  		sleep 1
+		ticks=$((ticks+1))
+		numticks=$(($ticks % 5))
+		if [ "${numticks}"  -eq 0 ]; then
+			printf "."
+		fi
+        done
+      fi
       ${bin_dir}/minifi.sh start
       ;;
     install)