mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Updated script to create cloud_usage database similar to deploy-db-dev.sh.
This commit is contained in:
parent
217fdd2497
commit
57927c9f23
@ -61,23 +61,31 @@ if [[ $OSTYPE == "cygwin" ]] ; then
|
|||||||
PATHSEP=';'
|
PATHSEP=';'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Recreating Database."
|
handle_error() {
|
||||||
mysql --user=root --password=$3 < create-database.sql > /dev/null 2>/dev/null
|
mysqlout=$?
|
||||||
mysqlout=$?
|
if [ $mysqlout -eq 1 ]; then
|
||||||
if [ $mysqlout -eq 1 ]; then
|
|
||||||
printf "Please enter root password for MySQL.\n"
|
printf "Please enter root password for MySQL.\n"
|
||||||
mysql --user=root --password < create-database.sql
|
mysql --user=root --password < $1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
printf "Error: Cannot execute create-database.sql\n"
|
printf "Error: Cannot execute $1\n"
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
elif [ $mysqlout -eq 127 ]; then
|
elif [ $mysqlout -eq 127 ]; then
|
||||||
printf "Error: Cannot execute create-database.sql - mysql command not found.\n"
|
printf "Error: Cannot execute $1 - mysql command not found.\n"
|
||||||
exit 11
|
exit 11
|
||||||
elif [ $mysqlout -ne 0 ]; then
|
elif [ $mysqlout -ne 0 ]; then
|
||||||
printf "Error: Cannot execute create-database.sql\n"
|
printf "Error: Cannot execute $1\n"
|
||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Recreating Database cloud."
|
||||||
|
mysql --user=root --password=$3 < create-database.sql > /dev/null 2>/dev/null
|
||||||
|
handle_error create-database.sql
|
||||||
|
|
||||||
|
echo "Recreating Database cloud_usage."
|
||||||
|
mysql --user=root --password=$3 < create-database-premium.sql > /dev/null 2>/dev/null
|
||||||
|
handle_error create-database-premium.sql
|
||||||
|
|
||||||
mysql --user=cloud --password=cloud cloud < create-schema.sql
|
mysql --user=cloud --password=cloud cloud < create-schema.sql
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -85,6 +93,12 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mysql --user=cloud --password=cloud < create-schema-premium.sql
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
printf "Error: Cannot execute create-schema-premium.sql\n"
|
||||||
|
exit 11
|
||||||
|
fi
|
||||||
|
|
||||||
mysql --user=cloud --password=cloud cloud < create-schema-simulator.sql
|
mysql --user=cloud --password=cloud cloud < create-schema-simulator.sql
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
printf "Error: Cannot execute create-schema-simulator.sql\n"
|
printf "Error: Cannot execute create-schema-simulator.sql\n"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user