check_curl

This commit is contained in:
Cyberes 2023-04-21 23:54:19 -06:00
parent f647e6fb74
commit ecfa98e531
1 changed files with 9 additions and 9 deletions

View File

@ -83,17 +83,17 @@ if $PRINT_ONLY; then
exit 3 exit 3
fi fi
RESPONSE=$(curl --output "$TMP_RESPONSE" -s -w "%{http_code}\n%{time_total}" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL 2>"$TMP_ERROR_LOG") RESPONSE=$(curl --output "$TMP_RESPONSE" -w "%{http_code}\n%{time_total}" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL 2>"$TMP_ERROR_LOG")
# shellcheck disable=SC2181 # shellcheck disable=SC2181
#if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
# echo "CRITICAL: curl failed!" echo "CRITICAL: curl failed!"
# echo "Error log:" echo "Error log:"
# cat "$TMP_ERROR_LOG" cat "$TMP_ERROR_LOG"
# rm -rf "$TMP_ERROR_LOG" rm -rf "$TMP_ERROR_LOG"
# exit 2 exit 2
#fi fi
#rm -rf "$TMP_ERROR_LOG" rm -rf "$TMP_ERROR_LOG"
RESPONSE_CODE=$(echo "$RESPONSE" | head -n 1) RESPONSE_CODE=$(echo "$RESPONSE" | head -n 1)
RESPONSE_TIME=$(printf "%.3f" $(echo "$RESPONSE" | tail -n 1)) RESPONSE_TIME=$(printf "%.3f" $(echo "$RESPONSE" | tail -n 1))