Custom dns post-scripts, when do they run?

kristian

Verified User
Joined
Nov 4, 2005
Messages
461
Location
Norway
Hi,

I need a script to be run each time a domain is created or removed from the DA-server, and I've found these:

dns_create_post.sh
dns_delete_post.sh

However, I am unsure if these are also run if the entire user is created/removed or just a domain within a user?

Are the above mentioned scripts *always* run whenever a change in the zones happens?

Thanks for any help or pointers,

Edit: Found this script as well:
domain_change_post.sh
Will the create/delete-scripts make this one unnecessary?
 
Last edited:
Hello,

Your best bet is to use:

domain_create_post.sh
domain_destroy_post.sh

Any time a domain is deleted/created, these will be called, including when a user is deleted/created as a domain is deleted/created within that action.

The dns scripts only relates to dns.. which is a subset of a domain, but you can create a dns zone via the Admin Level -> DNS Administration *without* creating a domain through DA.. so it's whatever you're trying to accomplish.

If you want a trigger for every "change" in a dns zone, use:
dns_write_post.sh

For a list of scripts:
http://www.directadmin.com/search_versions.php?query=post.sh
Ther are some listed in the README filein the ./scripts/custom directory.

John
 
The dns scripts only relates to dns.. which is a subset of a domain, but you can create a dns zone via the Admin Level -> DNS Administration *without* creating a domain through DA.. so it's whatever you're trying to accomplish.

Alright, it seems that the dns_create_post.sh/dns_delete_post.sh is what I need then. This is a part of a hidden master-setup for DNS, so I need to keep my list of zones on the DA-server up to date at all times, even if the zone doesn't have an account linked to it.

Thanks.
 
Bumping an old thread here, but I can't seem to find any information about this.

If one of these custom scripts generate output to either stdout or stderr, where is it sent? Can I tell DA to mail any output to a specific mail-address?
 
It's sent to the calling program.. ie: if it's being run through DA during a click, you'd likely see it on the screen.

If you want to pipe something to an email, then send the email in your script, eg:
Code:
echo -e "Subject: testing\n\nhi how are you\n.\n" | /usr/sbin/exim [email protected]
John
 
Got another question - after the addition or deletion of a zone from DNS, I suppose bind is reloaded.

Does the reload occur before or after the custom dns_create_post.sh/dns_delete_post.sh-scripts are run?

The reason I'm asking is that these custom scripts of mine are themselves modifying a zone which needs to be reloaded too.
 
reloads are always done via the task.queue... meaning, the command to restart/reload named is added to the task.queue and wil be run up to one full minute after the script has run. You should be safe to not restart named.

For safe measure (if you want), you can have you script type:

echo "action=named&value=reload" >> /usr/local/directadmin/data/task.queue

Which will at worst, create a double entry. Multiple entries are singled out, so named wil only be reloaded once, so there is no harm on doing that if you want.

John
 
Back
Top