diff --git a/getmyip b/getmyip index 90486f9..fc9b5ef 100755 --- a/getmyip +++ b/getmyip @@ -37,13 +37,15 @@ get_public_ip() { # Check if the curl request was successful and there's a valid IP address if [[ $? -eq 0 && $public_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + logger -t public_ip_script "Service used: $service, IP found: $public_ip" echo "$public_ip" return fi done # If none of the services returned a valid IP, output an error message - echo "Error: Failed to retrieve public IP using all services." >&2 + echo "Failed to retrieve public IP using all services." >&2 + logger -t public_ip_script "Error: Failed to retrieve public IP using all services." exit 1 }