pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/16137 )


Change subject: respawn.sh: Add logging and limit loop iterations
......................................................................

respawn.sh: Add logging and limit loop iterations

Since we'll now log the script and its children output to a file, let's
make sure the loop doesn't run countless times upon failing child
process, producing lots of potential undesired output. For instance, if
osmo-bts fails to read vty config and exits immediately.

Change-Id: Icc8cac889d94d4cce7d6365781d5b5364404b5b9
---
M osmo-bts-latest/respawn.sh
M osmo-bts-master/respawn.sh
M osmo-pcu-latest/respawn.sh
M osmo-pcu-master/respawn.sh
4 files changed, 28 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/37/16137/1

diff --git a/osmo-bts-latest/respawn.sh b/osmo-bts-latest/respawn.sh
index ae5cf60..2413916 100755
--- a/osmo-bts-latest/respawn.sh
+++ b/osmo-bts-latest/respawn.sh
@@ -2,8 +2,14 @@

 trap "kill 0" EXIT

-while [ -e /etc/passwd ]; do
+i=0
+max_i=500
+while [ $i -lt $max_i ]; do
+       echo "$i: starting: $*"
        $* &
        LAST_PID=$!
        wait $LAST_PID
+       echo "$i: stopped pid $LAST_PID with status $?"
+       i=$(expr $i + 1)
 done
+echo "exiting after $max_i runs"
diff --git a/osmo-bts-master/respawn.sh b/osmo-bts-master/respawn.sh
index ae5cf60..2413916 100755
--- a/osmo-bts-master/respawn.sh
+++ b/osmo-bts-master/respawn.sh
@@ -2,8 +2,14 @@

 trap "kill 0" EXIT

-while [ -e /etc/passwd ]; do
+i=0
+max_i=500
+while [ $i -lt $max_i ]; do
+       echo "$i: starting: $*"
        $* &
        LAST_PID=$!
        wait $LAST_PID
+       echo "$i: stopped pid $LAST_PID with status $?"
+       i=$(expr $i + 1)
 done
+echo "exiting after $max_i runs"
diff --git a/osmo-pcu-latest/respawn.sh b/osmo-pcu-latest/respawn.sh
index ae5cf60..2413916 100755
--- a/osmo-pcu-latest/respawn.sh
+++ b/osmo-pcu-latest/respawn.sh
@@ -2,8 +2,14 @@

 trap "kill 0" EXIT

-while [ -e /etc/passwd ]; do
+i=0
+max_i=500
+while [ $i -lt $max_i ]; do
+       echo "$i: starting: $*"
        $* &
        LAST_PID=$!
        wait $LAST_PID
+       echo "$i: stopped pid $LAST_PID with status $?"
+       i=$(expr $i + 1)
 done
+echo "exiting after $max_i runs"
diff --git a/osmo-pcu-master/respawn.sh b/osmo-pcu-master/respawn.sh
index ae5cf60..2413916 100755
--- a/osmo-pcu-master/respawn.sh
+++ b/osmo-pcu-master/respawn.sh
@@ -2,8 +2,14 @@

 trap "kill 0" EXIT

-while [ -e /etc/passwd ]; do
+i=0
+max_i=500
+while [ $i -lt $max_i ]; do
+       echo "$i: starting: $*"
        $* &
        LAST_PID=$!
        wait $LAST_PID
+       echo "$i: stopped pid $LAST_PID with status $?"
+       i=$(expr $i + 1)
 done
+echo "exiting after $max_i runs"

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/16137
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: Icc8cac889d94d4cce7d6365781d5b5364404b5b9
Gerrit-Change-Number: 16137
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to