How to setup a limit so that Users/Resellers cannot create more than 200 domains on a server.
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:
in it, place the following code:
if [ "$command" = "/CMD_ACCOUNT_USER" ] && [ "$action" = "create" ]; then
if [ "$command" = "/CMD_DOMAIN" ] && [ "$action" = "create" ]; then
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";
Save/exit, and chmod the all_pre.sh script to 755.