Removing zone when its a subdomain

rjanssen

Verified User
Joined
Apr 15, 2016
Messages
7
Hi,

I want to remove a zone when the domain is a subdomain. So I created the following:

Code:
#!/bin/sh

numofo=$(grep -o "\." <<< "$DOMAIN" | wc -l)
if [ $numofo -ge 2 ]; then
    sed -i '/$DOMAIN/d' /etc/named.conf
    echo "action=named&value=reload" >> /usr/local/directadmin/data/task.queue
fi

exit 0;

It's not a problem that .co.uk domains are seen as subdomain.

I've put this in the file /usr/local/directadmin/scripts/custom/dns_create_post.sh but it runs before the line is add to /etc/named.conf. Any idea's?


Kind regards,

Rick
 
Hi Alex,

I've tried that, but it seems like the entry is add to /etc/named.conf after the script runs. When I add "cat /etc/named.conf > /testnamedconf" it doesn't show up, but when I run it manually after adding the domain it is there.

Any other idea's?


Kind regards,

Rick
 
Rick,

Try this one:

subdomain_create_post.sh - Runs AFTER the subdomain is created.
https://www.directadmin.com/features.php?id=445
 
Hi Alex,

This is about adding a subdomain as normal domain. Some of our customers like to have different data locations for the websites instead of a subdomain folder.

I could make a script that checks a minute after the domain has been added, but it doesn't feel quite right to make it work like that.


Kind regards,

Rick
 
Back
Top