mirror of
https://ghproxy.net/https://github.com/CaptainCore/captaincore.git
synced 2025-10-04 01:48:24 +08:00
👌 IMPROVE: Monitor check
This commit is contained in:
parent
9270035ee5
commit
f1896c422e
1 changed files with 2 additions and 2 deletions
|
@ -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 </html> from bottom if found. Valid code should contain </html> 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 </html> found
|
||||
if [[ $html_end_tag == "</html>" ]]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue