How to add domains, subdomains in bulk to VestaCP?

How to add domains, subdomains in bulk to VestaCP?To add domains or subdomains in bulk to the VESTACP panel - you can use the standard Vesta scripts in the folder/usr/local/vesta/bin/. You need to write a bash script that will add your domains in a loop.

1. In the /root/ folder create a file domains.txt with a list of domains or subdomains to be added.

2. Create file vesta-add-domains.sh in the /root/ folder

#!/bin/bash

for domainname in $(cat domains.txt)
do
/usr/local/vesta/bin/v-add-domain admin $domainname '' 'no'
echo "$domainname"
done;
echo "-- FINISHED --"
exit;	

3. If you created files in Windows, and not using server utilities, then you need to convert line breaks in the created files to Unix format

You can use the dos2unix utility under Linux.

yum install dos2unix
dos2unix vesta-add-domains.sh
dos2unix domains.txt	

4. Run bash script vesta-add-domains.sh from the /root/ folder

./vesta-add-domains.sh

5. Restart VPS

reboot