gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-mdb] branch master updated: bugfixes in network monitor scr


From: gnunet
Subject: [taler-taler-mdb] branch master updated: bugfixes in network monitor script
Date: Sun, 14 Jan 2024 17:38:59 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository taler-mdb.

The following commit(s) were added to refs/heads/master by this push:
     new 4dba755  bugfixes in network monitor script
4dba755 is described below

commit 4dba7559104d0fbd2eae364a848d118da51d10f8
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sun Jan 14 17:38:56 2024 +0100

    bugfixes in network monitor script
---
 contrib/taler-mdb-network-check.sh | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/contrib/taler-mdb-network-check.sh 
b/contrib/taler-mdb-network-check.sh
index da3eb53..17dfd66 100755
--- a/contrib/taler-mdb-network-check.sh
+++ b/contrib/taler-mdb-network-check.sh
@@ -29,6 +29,7 @@ set -eu
 
 EXIT_STATUS=0
 CHILD_PID=-1
+ERROR_PID=-1
 
 # Exit, with error message (hard failure)
 function exit_fail() {
@@ -86,6 +87,13 @@ function cleanup()
 # Failure. Stop our child (if any) and show it.
 function show_failure()
 {
+    echo "Showing failure $1"
+    if [ "$ERROR_PID" != "-1" ]
+    then
+        kill -TERM "$ERROR_PID"
+        wait
+        ERROR_PID="-1"
+    fi
     if [ "$CHILD_PID" != "-1" ]
     then
         kill -TERM "$CHILD_PID"
@@ -93,14 +101,20 @@ function show_failure()
         CHILD_PID="-1"
     fi
     ${FAIL_PROG} "$1" >&2 &
-    CHILD_PID=$!
+    ERROR_PID=$!
 }
 
 # Function to run when our child died.
 function childdeath()
 {
+    if [ "$ERROR_PID" != "-1" ]
+    then
+        wait ${ERROR_PID}
+        ERROR_PID="-1"
+    fi
     if [ "$CHILD_PID" != "-1" ]
     then
+       echo "taler-mdb died"
         wait ${CHILD_PID}
         CHILD_PID="-1"
         show_failure child-died
@@ -169,22 +183,28 @@ function check_network()
         return
     fi
 
-    if [ "$CHILD_PID" != "-1" ]
+    echo "Network OK"
+    if [ "$ERROR_PID" != "-1" ]
     then
-        kill -TERM "$CHILD_PID"
+        kill -TERM "$ERROR_PID"
         wait
-        CHILD_PID="-1"
+        ERROR_PID="-1"
+    fi
+    
+    if [ "$CHILD_PID" = "-1" ]
+    then
+       echo "Starting child using $@"
+       # shellcheck disable=SC2068
+       $@ &
+       CHILD_PID=$!
     fi
-    echo "Network OK, starting child"
-    # shellcheck disable=SC2068
-    $@ &
-    CHILD_PID=$!
 }
 
 
 # Check network status
 while true
 do
+    echo "Checking network status"
     check_network
     sleep 30
 done

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]