check_curl print

This commit is contained in:
Cyberes 2023-04-21 23:54:19 -06:00
parent f43fcb81d1
commit 49e6539d34
1 changed files with 5 additions and 4 deletions

View File

@ -75,10 +75,10 @@ for value in "${values[@]}"; do
HEADER_ARGS+=' -H "'$value'" ' HEADER_ARGS+=' -H "'$value'" '
done done
#if $PRINT_ONLY; then if $PRINT_ONLY; then
# echo "curl $CURL_CMD" echo "curl --output \"$TMP_RESPONSE\" -s -w \"%{http_code}\n%{time_total}"\ $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL"
# exit 3 exit 3
#fi fi
TMP_ERROR_LOG=$(mktemp) TMP_ERROR_LOG=$(mktemp)
TMP_RESPONSE=$(mktemp) TMP_RESPONSE=$(mktemp)
@ -89,6 +89,7 @@ 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"
exit 2 exit 2
fi fi
rm -rf "$TMP_ERROR_LOG" rm -rf "$TMP_ERROR_LOG"