ctdb-scripts: Always print footer when debugging hung script
authorMartin Schwenke <martin@meltin.net>
Thu, 26 Jun 2014 04:46:54 +0000 (14:46 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 3 Jul 2014 03:55:13 +0000 (05:55 +0200)
There shouldn't be an early exit for the "init" event.  Just make the
"ctdb scriptstatus" call conditional.

While here, move the comment about only running a single instance to
be near locking code.  The comment is more useful there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/debug-hung-script.sh

index 63d695f01b3f79662c642336f3ad2605d66462ec..f353b7d4bc190560254caabe9a8a47abf4a74617 100755 (executable)
@@ -13,6 +13,9 @@ if [ -n "$CTDB_DEBUG_HUNG_SCRIPT_LOGFILE" ] ; then
 fi
 
 (
+    # No use running several of these in parallel if, say, "releaseip"
+    # event hangs for multiple IPs.  In that case the output would be
+    # interleaved in the log and would just be confusing.
     flock --wait 2 9 || exit 1
 
     echo "===== Start of hung script debug for PID=\"$1\", event=\"$2\" ====="
@@ -38,16 +41,11 @@ fi
        fi
     done
 
-    if [ "$2" = "init" ] ; then
-       exit 0
+    if [ "$2" != "init" ] ; then
+       echo "---- ctdb scriptstatus ${2}: ----"
+       ctdb scriptstatus "$2"
     fi
 
-    echo "---- ctdb scriptstatus ${2}: ----"
-    # No use running several of these in parallel if, say, "releaseip"
-    # event hangs for multiple IPs.  In that case the output would be
-    # interleaved in the log and would just be confusing.
-    ctdb scriptstatus "$2"
-
     echo "===== End of hung script debug for PID=\"$1\", event=\"$2\" ====="
 
 ) 9>"${CTDB_VARDIR}/debug-hung-script.lock"