ncsid: update_ra_gw: Fix SIGTERM handling
We need to make sure we handle TERMS correctly so the service can
shutdown in a reasonable amount of time.
Change-Id: I955f0871d7f9764de7565390913a7db2942e418e
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/subprojects/ncsid/src/update_ra_gw.sh b/subprojects/ncsid/src/update_ra_gw.sh
index 5ebb15a..58fdc52 100644
--- a/subprojects/ncsid/src/update_ra_gw.sh
+++ b/subprojects/ncsid/src/update_ra_gw.sh
@@ -19,10 +19,12 @@
local netdev="$1"
local reqs=5
- while true; do
+ while ! ShouldTerm; do
+ local st=0
local disc
- if ! disc="$(RunInterruptible DiscoverRouter6 "$1" "$reqs" 360000)"; then
- echo "Failed to discover router" >&2
+ disc="$(RunInterruptible DiscoverRouter6 "$1" "$reqs" 360000)" || st=$?
+ if (( st != 0 )); then
+ echo "Failed to discover router: $st" >&2
continue
fi
# We don't want to send any requests after the initial finding