Fixing bugs

This commit is contained in:
Eric Renfro 2023-10-31 14:24:22 -04:00
parent c211996036
commit 233560167b
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF

View file

@ -44,9 +44,9 @@ _update_dns_namecheap() {
local result local result
local errors local errors
result="$(curl -qs "https://dynamicdns.park-your-domain.com/update?host=${dnsHostname}&domain=${dnsDomain}&password=${dnsToken}&ip=${dnsIP}" | grep ErrCount)" result="$(curl -qs \"https://dynamicdns.park-your-domain.com/update?host=${dnsHostname}&domain=${dnsDomain}&password=${dnsToken}&ip=${dnsIP}" | grep ErrCount)"
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
errors="$(set -n -e 's/.*<ErrCount>\(.*\)<\/ErrCount>.*/\1/p' <<< $result)" errors="$(grep oPm1 "(?<=<ErrCount>)[^<]+" <<< $result)"
if [[ "$errors" -eq 0 ]]; then if [[ "$errors" -eq 0 ]]; then
echo "DNS record ${dnsHostname}.${dnsDomain} updated successfully." echo "DNS record ${dnsHostname}.${dnsDomain} updated successfully."
@ -63,14 +63,16 @@ _update_dns_namecheap() {
# Main # Main
_get_host_and_domain "$DIP_RECORD" || exit 99 _get_host_and_domain "$DIP_RECORD" || return 99
if valid_ipv4 "$DIP_CUR_IP"; then if valid_ipv4 "$DIP_CUR_IP"; then
log "Updating Namecheap DNS IPv4 Record for ${hostname}.${domain}" log "Updating Namecheap DNS IPv4 Record for ${hostname}.${domain}"
_update_dns_namecheap "$hostname" "$domain" "$token" "${DIP_CUR_IP}" _update_dns_namecheap "$hostname" "$domain" "$token" "${DIP_CUR_IP}"
return $?
fi fi
if valid_ipv6 "$DIP_CUR_IP"; then if valid_ipv6 "$DIP_CUR_IP"; then
log "Updating Namecheap DNS IPv6 Record for ${hostname}.${domain}" log "Updating Namecheap DNS IPv6 Record for ${hostname}.${domain}"
_update_dns_namecheap "$hostname" "$domain" "$token" "${DIP_CUR_IP}" _update_dns_namecheap "$hostname" "$domain" "$token" "${DIP_CUR_IP}"
return $?
fi fi