check_curl print
This commit is contained in:
parent
e119301f2b
commit
f647e6fb74
18
check_curl
18
check_curl
|
@ -79,21 +79,21 @@ TMP_ERROR_LOG=$(mktemp)
|
|||
TMP_RESPONSE=$(mktemp)
|
||||
|
||||
if $PRINT_ONLY; then
|
||||
printf "%s" "curl --output \"$TMP_RESPONSE\" -s -w \"%{http_code}\n%{time_total}\" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL"
|
||||
printf "%s" "curl --output \"$TMP_RESPONSE\" -s -w \"%{http_code}\n%{time_total}\" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL\n"
|
||||
exit 3
|
||||
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")
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "CRITICAL: curl failed!"
|
||||
echo "Error log:"
|
||||
cat "$TMP_ERROR_LOG"
|
||||
rm -rf "$TMP_ERROR_LOG"
|
||||
exit 2
|
||||
fi
|
||||
rm -rf "$TMP_ERROR_LOG"
|
||||
#if [ $? -ne 0 ]; then
|
||||
# echo "CRITICAL: curl failed!"
|
||||
# echo "Error log:"
|
||||
# cat "$TMP_ERROR_LOG"
|
||||
# rm -rf "$TMP_ERROR_LOG"
|
||||
# exit 2
|
||||
#fi
|
||||
#rm -rf "$TMP_ERROR_LOG"
|
||||
|
||||
RESPONSE_CODE=$(echo "$RESPONSE" | head -n 1)
|
||||
RESPONSE_TIME=$(printf "%.3f" $(echo "$RESPONSE" | tail -n 1))
|
||||
|
|
Loading…
Reference in New Issue