From 74d8d162db401ffbdea1dfc1fb9ddd63cfcca12a Mon Sep 17 00:00:00 2001 From: tbergervoet Date: Mon, 15 Oct 2018 13:25:19 +0200 Subject: [PATCH] Update 'Apache-Installer.sh' --- Apache-Installer.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Apache-Installer.sh b/Apache-Installer.sh index a7e4a78..09bab95 100644 --- a/Apache-Installer.sh +++ b/Apache-Installer.sh @@ -155,8 +155,9 @@ certbot --apache -n -d "$domain" -d "www.$domain" -m "$email" --hsts --redirect ##---------------## if [ $wordpress = 1 ]; then - db_name="wp_1" - db_user="wp_1" + db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1` + db_name="wp_$db_suffix" + db_user="wp_$db_suffix" db_pass=$(date +%s|sha256sum|base64|head -c 32) mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"