From 4e38e8596282852af522a34ab28f55c120cd84f4 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 6 Oct 2020 17:55:24 +0200 Subject: [PATCH] bugfix: add greater delay to test_api to let cpu usage settle on slower devices --- scripts/install_moonraker.sh | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/scripts/install_moonraker.sh b/scripts/install_moonraker.sh index c5fcf3f..8296e7d 100755 --- a/scripts/install_moonraker.sh +++ b/scripts/install_moonraker.sh @@ -671,27 +671,22 @@ handle_haproxy_lighttpd(){ test_api(){ HOST_IP=$(hostname -I | cut -d" " -f1) status_msg "Testing API ..." - sleep 5 - status_msg "API response from http://$HOST_IP:7125/printer/info :" - API_RESPONSE=$(curl -sG4m5 http://$HOST_IP:7125/printer/info) - echo -e "${cyan}$API_RESPONSE${default}" - if [ $(curl -sG4 "http://$HOST_IP:7125/printer/info" | grep '^{"result"' -c) -eq 1 ]; then + status_msg "Please wait ..." + sleep 15 + status_msg "API response from http://"$HOST_IP":7125/printer/info :" + echo -e "${cyan}$(curl -s "http://"$HOST_IP":7125/printer/info")${default}" + if [ $(curl -s "http://"$HOST_IP":7125/printer/info" | grep '^{"result"' -c) -eq 1 ]; then echo; ok_msg "Klipper API is working correctly!"; echo else echo; warn_msg "Klipper API not working correctly!"; echo fi -} - -#test_nginx(){ -# HOST_IP=$(hostname -I | cut -d" " -f1) -# status_msg "Testing Nginx ..." -# sleep 5 -# status_msg "API response from http://$HOST_IP/printer/info :" -# API_RESPONSE="$(curl -sG4m5 http://$HOST_IP/printer/info)" -# echo -e "${cyan}$API_RESPONSE${default}" -# if [ $(curl -sG4 "http://$HOST_IP/printer/info" | grep '^{"result"' -c) -eq 1 #]; then -# echo; ok_msg "Nginx is working correctly!"; echo -# else -# echo; warn_msg "Nginx is not working correctly!"; echo -# fi -#} \ No newline at end of file + status_msg "Testing Nginx ..." + status_msg "Please wait ..." + status_msg "API response from http://"$HOST_IP"/printer/info :" + echo -e "${cyan}$(curl -s "http://"$HOST_IP"/printer/info")${default}" + if [ $(curl -s "http://"$HOST_IP"/printer/info" | grep '^{"result"' -c) -eq 1 ]; then + echo; ok_msg "Nginx is working correctly!"; echo + else + echo; warn_msg "Nginx is not working correctly!"; echo + fi +} \ No newline at end of file