detect correct MySQL password with the new readonly account

This commit is contained in:
2015-07-07 13:14:01 +03:00
parent 64ccc55a24
commit 728d6dcaff

View File

@@ -1,7 +1,31 @@
# uber-standardsetup.sh
#
# Copyright (C) 2015 Max Mehl <mail@mehl.mx>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#!/bin/bash
SERVER=$(echo $HOSTNAME | sed -e 's/.uberspace.de//g')
VIRTUAL=/var/www/virtual/$USER
MYSQLPASS=$(awk '/^\[client\]/,/^password=/' ~/.my.cnf | grep "password=" | sed -e 's/password=//g' | sed -e 's/[ \t].*//g')
# In older hosts, there's only 1 MySQL password and not 2
if [ "$MYSQLPASS" == "" ]; then
MYSQLPASS=$(grep "password=" ~/.my.cnf | sed -e 's/password=//g' | sed -e 's/[ \t].*//g')
fi
read -p "Domain: " DOMAIN
IP=$(curl -s curlmyip.com)