mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-19 17:17:04 -04:00
Add retry_quiet() function to retry quietly for an event to occur
(cherry picked from commit 31264a7e00)
This commit is contained in:
parent
2a368efd53
commit
699bcc70ca
1 changed files with 18 additions and 4 deletions
|
|
@ -338,9 +338,9 @@ nextpartpeek() {
|
|||
nextpartread $1 2> /dev/null
|
||||
}
|
||||
|
||||
# retry: keep running a command until it succeeds, up to $1 times, with
|
||||
# one-second intervals
|
||||
retry() {
|
||||
# _retry: keep running a command until it succeeds, up to $1 times, with
|
||||
# one-second intervals, optionally printing a message upon every attempt
|
||||
_retry() {
|
||||
__retries="${1}"
|
||||
shift
|
||||
|
||||
|
|
@ -350,7 +350,9 @@ retry() {
|
|||
fi
|
||||
__retries=$((__retries-1))
|
||||
if [ "${__retries}" -gt 0 ]; then
|
||||
echo_i "retrying"
|
||||
if [ "${__retry_quiet}" -ne 1 ]; then
|
||||
echo_i "retrying"
|
||||
fi
|
||||
sleep 1
|
||||
else
|
||||
return 1
|
||||
|
|
@ -358,6 +360,18 @@ retry() {
|
|||
done
|
||||
}
|
||||
|
||||
# retry: call _retry() in verbose mode
|
||||
retry() {
|
||||
__retry_quiet=0
|
||||
_retry "$@"
|
||||
}
|
||||
|
||||
# retry_quiet: call _retry() in silent mode
|
||||
retry_quiet() {
|
||||
__retry_quiet=1
|
||||
_retry "$@"
|
||||
}
|
||||
|
||||
rndc_reload() {
|
||||
echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'$1' /'`"
|
||||
# reloading single zone is synchronous, if we're reloading whole server
|
||||
|
|
|
|||
Loading…
Reference in a new issue