Vestacp
Перейти к навигации
Перейти к поиску
Скрипт создания пользователей и баз данных
cat << 'EOF' > /opt/create_users.sh #!/bin/bash dbhost='10.207.144.159' # vestacp host in local net vestacp_template='OneHost' # vestacp template name lineTitle='domain,ftp/sftp/ssh user,ftp/sftp/ssh user password,mysql user,mysql password,mysql dbname,pgsql user,pgsql password,pgsql dbname,ftp/sftp/ssh/mysql/pgsql host' rm /etc/hosts_squid echo $lineTitle > ./list.csv for i in $(seq -w 1 400); do user="user${i}" pass=$(pwgen 6 1) lineData="http://h${i}.web161,${user},${pass},${user}_user1,m_${pass},${user}_db1,${user}_user2,p_${pass},${user}_db2,${dbhost}" v-add-user "${user}" "${pass}" "${user}@${i}.web" "${vestacp_template}" v-add-web-domain "${user}" "h${i}.web161" v-add-database "${user}" "db1" "user1" "m_${pass}" "mysql" v-add-database "${user}" "db2" "user2" "p_${pass}" "pgsql" v-change-database-password "${user}" "${user}_db2" "p_${pass}" echo $lineData >> ./list.csv echo "${dbhost} h${i}.web161" >> /etc/hosts_squid echo "${user} -- done" sleep 1s done EOF
Запуск
chmod +x /opt/create_users.sh /opt/create_users.sh