How to bulk add domains to vestaCP?

General questions about VestaCP
wooze
Posts: 1
Joined: Thu Oct 05, 2017 11:29 am

How to bulk add domains to vestaCP?

Postby wooze » Thu Oct 05, 2017 11:37 am

Hi everyone :)

That's my first topic and I'm starting my journey with VestaCP :).

I need to add in bulk:
- about 20 databases (every diffrent password and name)
- about 20 domains but every domin need to have added:
a) two different A records
b) two changes in "12 lists records" (localhost to the name of domain.

What can you recommend for me?
Regards,
W

skurudo
VestaCP Team
Posts: 7798
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

Re: How to bulk add domains to vestaCP?

Postby skurudo » Fri Oct 06, 2017 12:11 pm

bash script

commands:
v-add-domain
Usage: v-add-domain USER DOMAIN [IP] [RESTART]


v-add-database
Usage: v-add-database USER DATABASE DBUSER DBPASS [TYPE] [HOST] [CHARSET]
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

DarthVader
Posts: 10
Joined: Wed Jul 13, 2016 1:35 pm

Re: How to bulk add domains to vestaCP?

Postby DarthVader » Mon Oct 09, 2017 5:31 pm

This is script to bulk add email account.
You can rewrite him to use for buld add domains and databases

Code: Select all

#!/bin/bash
username='john'
emails="$(cat emails)"
outfile='passwd'
if [ -a $outfile ]; then
    rm -f $outfile
fi

for email in $emails;
do

    account="$(echo $email | awk --field-separator='@' '{print $1}')"
    domain="$(echo $email | awk --field-separator='@' '{print $2}')"
    password="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};echo;)"

    #Usage: v-add-mail-account USER DOMAIN ACCOUNT PASSWORD [QUOTA]   
    /usr/local/vesta/bin/v-add-mail-account $username $domain $account $password 1000
    echo $email   $password >> $outfile
   
done


Return to “General Discussion”



Who is online

Users browsing this forum: No registered users and 5 guests

cron