Mercurial > hg > thermostat-ng
changeset 6:0a17affdae81
Fix error checking in thermostat-ng.sh
Reviewed-by: jkang
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-July/024263.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Fri, 21 Jul 2017 18:01:22 +0200 |
parents | c69fd8f97d50 |
children | 14282b595c1d |
files | thermostat-ng.sh |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/thermostat-ng.sh Tue Jul 18 18:46:20 2017 +0200 +++ b/thermostat-ng.sh Fri Jul 21 18:01:22 2017 +0200 @@ -63,11 +63,12 @@ local max_attempts=40 while [ $max_attempts -gt 0 ]; do if grep -q "$expected_msg" "$log_file"; then - break + return 0 fi sleep 1 max_attempts=$(( $max_attempts - 1 )) done + return 1 } # Start/Stop mongodb @@ -88,12 +89,14 @@ start_web_gateway() { local error=0 + local fail_msg="Failed to start web-gateway" echo "Starting web-gateway ..." $WEB_GATEWAY_ROOT/distribution/target/image/bin/thermostat-web-gateway.sh > "$GW_LOG_FILE" 2>&1 & error=$? echo $! > "$GW_PID_FILE" - check_success_msg $error "Failed to start web-gateway" + check_success_msg $error $fail_msg wait_for_ready "Server:main: Started" "$GW_LOG_FILE" + check_success_msg $? $fail_msg echo "web-gateway started." echo "PID file: $GW_PID_FILE" echo "Log file: $GW_LOG_FILE" @@ -131,11 +134,13 @@ } start_agent() { + local fail_msg="Failed to start agent" config_agent echo "Starting agent ..." $AGENT_ROOT/distribution/target/image/bin/thermostat -J-Dthermostat.agent.verbose=true -Tbg "$AGENT_PID_FILE" > "$AGENT_LOG_FILE" 2>&1 - check_success_msg $? "Failed to start agent" + check_success_msg $? $fail_msg wait_for_ready "Agent started" "$AGENT_LOG_FILE" + check_success_msg $? $fail_msg echo "agent started." echo "PID file: $AGENT_PID_FILE" echo "Log file: $AGENT_LOG_FILE"