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
This commit is contained in:
parent
a9877bf487
commit
0193073507
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue