# Simple maintenance script to clean orphaned DNS zones on the local server
# Written by Erik S. (e@inmotion.net / ext 834)
# cron config appends stdout/err to /var/log/maint/dnsclean.log
do domain=$(sed 's/.db$//' <<< "$zone_file")
check_dom_owner=$(/scripts/whoowns "$domain")
if [ "$check_dom_owner" == "" ]; then
echo "$(date "+%D %T"): $domain has no owner, auto-cleaning zone file: $zone_file"
rm -f "/var/named/$domain.db"
sed -e "/^zone \"$domain\"/,+4 d" -i /etc/named.conf