Custom Bash Script in DA:
/directadmin/scripts/custom/domain_create_post.sh
Below code:
SET UP DATABASE VARIABLES
dbpass=$(openssl rand -base64 12) > /dev/null
ext=$(openssl rand -hex 2) > /dev/null
dbuser="wp${ext}" # do not include the username_ for dataskq here as DA adds this
wpconfigdbuser="${username}_wp${ext}"
wpadminpass=$(openssl rand -base64 14) > /dev/null
CREATE DATABASE
/usr/bin/mysqladmin -uda_admin -p$(cat /usr/local/directadmin/conf/mysql.conf | grep pass | cut -d\= -f2 ) create ${wpconfigdbuser};
echo "CREATE USER ${wpconfigdbuser} IDENTIFIED BY '${dbpass}';" | mysql -uda_admin -p$(cat /usr/local/directadmin/conf/mysql.conf | grep pass | cut -d\= -f2 );
echo "GRANT ALL PRIVILEGES ON ${wpconfigdbuser}.* TO ${wpconfigdbuser} IDENTIFIED BY '${dbpass}
DOWNLOAD AND INSERT SAMPLE TABLE TO CRATED DATABASE
mysql -u '.dbuser.' -p'.dbpass.' '.dbuser.' table_name < website.com/get/file.sql
Number of users: 0 Size: 0b
Please can anyone help me check this code?