From 9a1a5efbd98ac0155520f3ed5702fbc7a782b0cb Mon Sep 17 00:00:00 2001 From: Dave Conroy Date: Thu, 21 Apr 2022 12:12:57 -0700 Subject: [PATCH] Do a different DB Ready check for Influx 1 vs 2 --- install/assets/functions/10-db-backup | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/install/assets/functions/10-db-backup b/install/assets/functions/10-db-backup index cd17895..eac3494 100755 --- a/install/assets/functions/10-db-backup +++ b/install/assets/functions/10-db-backup @@ -333,14 +333,25 @@ check_availability() { ;; "influx" ) counter=0 - code_received=0 - while [ "${code_received}" != "200" ]; do - code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health) - if [ "${code_received}" = "200" ] ; then break ; fi - sleep 5 - (( counter+=5 )) - print_warn "InfluxDB Host '${DB_HOST}' is not accessible, retrying.. ($counter seconds so far)" - done + case "${INFLUX_VERSION,,}" in + 1 ) + while ! (nc -z ${DB_HOST#*//} ${DB_PORT}) ; do + sleep 5 + (( counter+=5 )) + print_warn "InfluxDB Host '${DB_HOST#*//}' is not accessible, retrying.. ($counter seconds so far)" + done + ;; + 2 ) + code_received=0 + while [ "${code_received}" != "200" ]; do + code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health) + if [ "${code_received}" = "200" ] ; then break ; fi + sleep 5 + (( counter+=5 )) + print_warn "InfluxDB Host '${DB_HOST}' is not accessible, retrying.. ($counter seconds so far)" + done + ;; + esac ;; "mongo" ) counter=0