The early exits from the sub-shell make the obvious successes much
more obvious, and slightly simplify the code that follows.
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
if rpcinfo -T tcp localhost "$_rpc_service" \
>/dev/null 2>&1; then
- _numfails=0
+ echo 0 >"$_failcount_file"
+ exit # from subshell
elif nfs_stats_check_changed \
"$_rpc_service" "$_iteration"; then
"$_rpc_service" \
"$_ver" \
>"$_out"
- _numfails=0
+ echo 0 >"$_failcount_file"
+ exit # from subshell
else
_numfails=$((_numfails + 1))
fi
fi
if [ $restart_every -gt 0 ] &&
- [ $_numfails -gt 0 ] &&
[ $((_numfails % restart_every)) -eq 0 ]; then
if ! $_unhealthy; then
rpc_failure \