Search K
Appearance
Appearance
This pre/post script is called before/after changing a domain name.
This script is called before/after a new domain has been created.
This script is called before/after a domain has been destroyed.
This script is called when a User modifies a domain (changes SSL, bandwidth, settings, etc.)
This is not for the change of a domain name, that's domain_change_pre.sh and domain_change_post.sh.
This hook is called before/after a domain pointer is created.
domainThis script is called before/after a domain pointer is destroyed.
domainThis hook script is called before/after a subdomain is created.
The hook script called before/after a subdomain is destroyed.
This hook is called before a User tries to set their Domain's php version.
5.6php1_select=2 (see: options.conf[phpX_release]).login_as_master_name=admin (variable for all hooks)domain_create_pre.sh to limit the number of domains allowed on a server If you want to cap the number of domains created on the server, you can use the domain_create_pre.sh to do so.
In this example, we'll see a maximum number of 10 domains, but you can change this number as desired.
/usr/local/directadmin/scripts/custom/domain_create_pre.shIn that script, add the code:
#!/bin/sh
MAX_DOMAINS=10
#obtains the exact number of domains on the system right now. The tally is delayed, and cannot be used.
CURRENT=`ls -la /etc/virtual/ | grep drwx | grep -v majordomo | grep -v usage | grep -c drwx`
if [ "$CURRENT" -ge "$MAX_DOMAINS" ]; then
echo "Maximum number of domains ($MAX_DOMAINS) has already been created. Cannot create any more."
exit 1;
fi
exit 0;chmod 755 /usr/local/directadmin/scripts/custom/domain_create_pre.sh
chown diradmin. /usr/local/directadmin/scripts/custom/domain_create_pre.shdomain_create_pre.sh is ran after the user is already created), so just create a link to it:cd /usr/local/directadmin/scripts/custom
ln -s domain_create_pre.sh user_create_pre.sh