From 08007a491f8696027470286189830f8039655901 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 12 May 2020 17:52:44 -0400 Subject: [PATCH] [fix] reboot error fix --- setup/so-functions | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 7d6aca05f..51647d316 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -91,13 +91,13 @@ wait_for_file() { local date date=$(date) - while [[ $cur_attempts < $max_attempts ]]; do + while [[ $cur_attempts -lt $max_attempts ]]; do if [ -f "$filename" ]; then - echo "File $filename already exists at $date" >> "$setup_log" 2>&1 + echo "File $filename found at $date" >> "$setup_log" 2>&1 return 0 else - echo "File $filename does not exist; waiting ${wait_interval}s then checking again ($cur_attempts/$max_attempts)..." >> "$setup_log" 2>&1 ((cur_attempts++)) + echo "File $filename does not exist; waiting ${wait_interval}s then checking again ($cur_attempts/$max_attempts)..." >> "$setup_log" 2>&1 sleep "$wait_interval" fi done @@ -195,11 +195,10 @@ check_admin_pass() { check_hive_init_then_reboot() { - local return_val - return_val="$(wait_for_file /opt/so/state/thehive.txt 20 5)" - - if [[ "$return_val" != 0 ]]; then - return "$return_val" + wait_for_file /opt/so/state/thehive.txt 20 5 + local return_val=$? + if [[ $return_val -ne 0 ]]; then + return $return_val fi docker stop so-thehive