Reputation: 51
Custom Bash Script in DA:
/directadmin/scripts/custom/domain_create_post.sh
Below code:
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
/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}
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?
Upvotes: 0
Views: 98
Reputation: 291
You are better off using the DA API calls. That way your script will keep working later on.
Upvotes: 0