From 5752ba21036d82b618bc2120ecf9e6f1d121d4ef Mon Sep 17 00:00:00 2001 From: Tom Hudson Date: Tue, 26 Jun 2018 11:58:48 +0000 Subject: [PATCH] Splits check-cnames --- scripts/check-cname | 14 ++++++++++++++ scripts/check-cnames.sh | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100755 scripts/check-cname 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 {}