diff options
Diffstat (limited to 'scripts/check_db_safety')
-rwxr-xr-x | scripts/check_db_safety | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/check_db_safety b/scripts/check_db_safety new file mode 100755 index 0000000..f3f3236 --- /dev/null +++ b/scripts/check_db_safety @@ -0,0 +1,29 @@ +#!/bin/sh +if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then + echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 + exit 1 +fi +for tld in db/dom/* ; do + if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then + tld="$(basename $tld)" + echo "There's a bad domain under $tld." >&2 + echo "You probably don't want to run any shell scripts." >&2 + exit 1 + fi + for dom in $tld/* ; do + if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then + domain="$(basename $dom).$(basename $tld)" + echo "There's a bad nameserver under $domain." >&2 + echo "You probably don't want to run any shell scripts." >&2 + fi + for ns in $dom/ns/* ; do + if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then + domain="$(basename $dom).$(basename $tld)" + nsname="$(basename $ns)" + echo "There's a bad nameserver IP under $domain, for" >&2 + echo " $nsname" >&2 + echo "You probably don't want to run any shell scripts." >&2 + fi + done + done +done |