Using to limit the number of domains allowed on a server

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » DirectAdmin » Custom Scripting

Using to limit the number of domains allowed on a serverLast Modified: May 31, 2012, 2:57 pm
If you want to cap the number of domains created on the server, you can use the to do so.
In this example, we'll see a maximum number of 10 domains, but you can change this number as desired.

1) Create the following file:


In that script, add the code:


#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;
exit 0;

2) chmod the script to 755:

chmod 755 /usr/local/directadmin/scripts/custom/

3) You may want to run this script before user creation as well ( is after the user is already created), so just create a link to it:

cd /usr/local/directadmin/scripts/custom
ln -s

Related Helpfiles
Limit the number of Users a Reseller can create

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST