From a931a17f264bdd91f0a271deb9c8d84ae57acdbd Mon Sep 17 00:00:00 2001 From: Jonas Friedmann Date: Wed, 7 Apr 2021 11:06:02 +0200 Subject: [PATCH] Improve current_rocketchat_version(), wait for slow server startup --- rocketchatctl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rocketchatctl b/rocketchatctl index b4c9c87..b533d22 100755 --- a/rocketchatctl +++ b/rocketchatctl @@ -763,7 +763,11 @@ get_rocketchat_latest_version(){ get_rocketchat_current_version(){ if systemctl status rocketchat > /dev/null 2>&1; then PORT=$(cat /lib/systemd/system/rocketchat.service |grep PORT |awk -F= '{print $3}') - current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4) + current_rocketchat_version="" + until [ -n "$current_rocketchat_version" ]; do + current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4) + sleep 1 + done else print_rocketchat_not_running_error_and_exit fi