summaryrefslogtreecommitdiffstats
path: root/standalone
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-04-16 10:08:08 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-04-16 10:08:09 +0800
commit2ab776ce04fd45c07d8918fdcb131b9b123250e5 (patch)
tree50105b457bac87266b4f65232b03bff3dd766dca /standalone
parentb86524dbd0d7ed1831031f682e8c3a081d57ad1f (diff)
Upgrade uui-server database to postgreSQL
Change-Id: I0cc146be21d3dc4cddbb635cdca931640f2c66f0 Issue-ID: USECASEUI-236 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'standalone')
-rw-r--r--standalone/src/main/assembly/bin/run.sh2
-rw-r--r--standalone/src/main/assembly/resources/bin/initDB.sh19
2 files changed, 13 insertions, 8 deletions
diff --git a/standalone/src/main/assembly/bin/run.sh b/standalone/src/main/assembly/bin/run.sh
index 57b49897..679fc208 100644
--- a/standalone/src/main/assembly/bin/run.sh
+++ b/standalone/src/main/assembly/bin/run.sh
@@ -25,7 +25,7 @@ sleep 10
echo "usecase-ui database init script start..."
dbScript="$main_path/resources/bin/initDB.sh"
chmod 755 $dbScript
-source $dbScript postgres postgres 127.0.0.1 5432 postgres
+source $dbScript 127.0.0.1 5432 postgres postgres postgres
echo "usecase-ui database init script finished normally..."
JAVA_PATH="$JAVA_HOME/bin/java"
diff --git a/standalone/src/main/assembly/resources/bin/initDB.sh b/standalone/src/main/assembly/resources/bin/initDB.sh
index a7ee1eed..8c4cc8b8 100644
--- a/standalone/src/main/assembly/resources/bin/initDB.sh
+++ b/standalone/src/main/assembly/resources/bin/initDB.sh
@@ -17,17 +17,22 @@
echo "setting database init parameters"
main_path="/home/uui"
-user=$1
-password=$2
-host=$3
-port=$4
-dbname=$5
+host=$1
+port=$2
+dbname=$3
+user=$4
+password=$5
+
+echo "setting postgres database password"
+su - $user <<EOF
+psql --command "alter user $user with password '$password';"
+EOF
echo "start create usecase-ui database..."
dbscripts_path="$main_path/resources/dbscripts/postgres"
psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_db.sql
sql_result=$?
-if [ $sql_result!=0 ] then
+if [ $sql_result!=0 ]; then
echo "failed to create usecase-ui database!"
exit 1
else
@@ -37,7 +42,7 @@ fi
echo "start create usecase-ui tables..."
psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_table.sql
sql_result=$?
-if [ $sql_result!=0 ] then
+if [ $sql_result!=0 ]; then
echo "failed to create usecase-ui table!"
exit 1
else