diff --git a/app/monitor-check b/app/monitor-check index 823e926..1f5cf42 100644 --- a/app/monitor-check +++ b/app/monitor-check @@ -19,7 +19,7 @@ run_command() { # Run the health check. Return http_code and body. response=$(curl --location --max-redirs 7 --user-agent "$user_agent" --write-out "|%{num_redirects}|%{http_code}" --max-time 30 --compressed --silent $url) - response_last_line=$( echo -e "$response" | tail -n1 ) + response_last_line=$( printf "%s\n" "$response" | tail -n1 ) # Pull out number of redirects num_redirects=$( echo -e "$response_last_line" | perl -ne '/.*\|(\d+)\|(\d+)$/&& print $1' ) @@ -28,7 +28,7 @@ run_command() { http_code=$( echo -e "$response_last_line" | perl -ne '/.*\|(\d+)\|(\d+)$/&& print $2' ) # Pull out from bottom if found. Valid code should contain near the bottom. - html_end_tag=$( echo -e "$response" | tail -n12 | perl -wnE'say for /<\/html>/g' ) + html_end_tag=$( printf "%s\n" "$response"| tail -n12 | perl -wnE'say for /<\/html>/g' ) # check if found if [[ $html_end_tag == "" ]]; then