diff --git a/scripts/check-cname b/scripts/check-cname new file mode 100755 index 0000000..cf81129 --- /dev/null +++ b/scripts/check-cname @@ -0,0 +1,14 @@ +#!/bin/bash + +domain="$1" + +if [ -z "$domain" ]; then + exit 1 +fi + +host -t CNAME "$domain" | grep 'is an alias for' | awk '{print $NF}' | +while read cname; do + if ! host "$cname" &>/dev/null; then + echo "$cname does not resolve (pointed at by $domain)"; + fi; +done diff --git a/scripts/check-cnames.sh b/scripts/check-cnames.sh index eaf1e04..9360bf0 100755 --- a/scripts/check-cnames.sh +++ b/scripts/check-cnames.sh @@ -1,9 +1,2 @@ #!/bin/bash - -xargs -P20 -n1 -I{} bash -c "host -t CNAME {} | - grep 'is an alias for' | awk '{print \$NF}' | - while read cname; do - if ! host \$cname &>/dev/null; then - echo \"\$cname does not resolve (pointed at by {})\"; - fi; - done" +xargs -P20 -n1 -I{} check-cname {}