Fixed logging

master
Keith Irwin 2022-11-06 18:26:14 -07:00
parent 21a31085ba
commit f962c906ae
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 3 additions and 5 deletions

View File

@ -48,9 +48,7 @@ fi
if ! domain="$("${LIB_DIR}/ns_lookup_rdns" "${ip}")"; then if ! domain="$("${LIB_DIR}/ns_lookup_rdns" "${ip}")"; then
printf 'ERROR! Failed to lookup domain from user IP %s\n' "${ip}" | tee -a "${LOGFILE}" | "${LIB_DIR}/http_res" 500 printf 'ERROR! Failed to lookup domain from user IP %s\n' "${ip}" | tee -a "${LOGFILE}" | "${LIB_DIR}/http_res" 500
exit 7 exit 7
fi fi; if ! username="$(<<<"${domain}" cut -d'.' -f2)"; then
printf "${domain}" >>"${LOGFILE}"
if ! username="$(<<<"${domain}" cut -d'.' -f2)"; then
printf 'ERROR! Failed to parse username from domain "%s"\n' "${domain}" >>"${LOGFILE}" printf 'ERROR! Failed to parse username from domain "%s"\n' "${domain}" >>"${LOGFILE}"
"${LIB_DIR}/http_res" 500 "${LIB_DIR}/http_res" 500
exit 8 exit 8
@ -71,7 +69,7 @@ if ! [ -f "${path}" ]; then
fi fi
# Try to return it to the user # Try to return it to the user
if ! <"${file}" "${LIB_DIR}/http_res" 200; then if ! <"${path}" "${LIB_DIR}/http_res" 200; then
printf 'ERROR! Failed to return file: "%s"\n' | tee -a "${LOGFILE}" | "${LIB_DIR}/http_res" 500 printf 'ERROR! Failed to return file: "%s"\n' "${path}" | tee -a "${LOGFILE}" | "${LIB_DIR}/http_res" 500
exit 11 exit 11
fi fi