How to setup a limit so that Users/Resellers cannot create more than 200 domains on a server.


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


Top Level » DirectAdmin

How to setup a limit so that Users/Resellers cannot create more than 200 domains on a server.Last Modified: May 2, 2007, 3:53 pm
If you want to keep a server at sane operating limits, you can prevent Users and Reseller from adding more domains by using the all_pre.sh script.   Note this will not apply to Admin's creating Rsellers (unless you want it to, just add the code).  Also backup restores are not checked by this script.. it's mainly only as a reminder that the limit is reached.  Also, the limit being checked is counted with the tally daily, so if a user adds 50 domains when thel limit is a 195, the block won't be imlemented until after that count is tallied at midnight.  You can change the limit of 200 to any value you want.

Create the script:
/usr/local/directadmin/scirpts/custom/all_pre.sh

in it, place the following code:

#!/bin/sh
MAX_DOMAINS=200
CREATING_DOMAIN=0
if [ "$command" = "/CMD_ACCOUNT_USER" ] && [ "$action" = "create" ]; then
  CREATING_DOMAIN=1
fi
if [ "$command" = "/CMD_DOMAIN" ] && [ "$action" = "create" ]; then
  CREATING_DOMAIN=1
fi
if [ $CREATING_DOMAIN -eq 1 ]; then
  CURRENT_COUNT=`cat /usr/local/directadmin/data/admin/admin.usage | grep vdomains | cut -d= -f2`
  if [ "$CURRENT_COUNT" -ge $MAX_DOMAINS ]; then
    echo "server is currently at it's limit of $MAX_DOMAINS";
    exit 1;
  fi
fi
exit 0;

Save/exit, and chmod the all_pre.sh script to 755.
 
Related Helpfiles
Ability to limit the POST functions that an account can run.
Using the all_pre.sh script to do custom filtering on any function.

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