-
Notifications
You must be signed in to change notification settings - Fork 3
/
cmd.sh
28 lines (20 loc) · 928 Bytes
/
cmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -e
export PGPASSWORD=openxds
if [[ ! -z `psql -h postgresql-openxds -p 5432 -U postgres -lqt | cut -d \| -f 1 | grep -w 'openxds'` ]]; then
echo "# Database OpenXDS exists #"
else
echo "# Init OpenXDS Database #"
psql -h postgresql-openxds -p 5432 -U postgres -c "CREATE USER openxds SUPERUSER PASSWORD 'openxds'"
psql -h postgresql-openxds -p 5432 -U postgres -c "CREATE DATABASE openxds OWNER 'openxds'";
psql -h postgresql-openxds -p 5432 -d openxds -U openxds -f /opt/openxds/misc/create_database_schema_postgres.sql
fi
if [[ ! -z `psql -h postgresql-openxds -p 5432 -U postgres -lqt | cut -d \| -f 1 | grep -w 'log2'` ]]; then
echo "# Database log2 exists #"
else
echo "# Init log2 Database#"
psql -h postgresql-openxds -p 5432 -U openxds -f /opt/openxds/misc/create_database_schema_log2_postgres.sql
fi
echo "# Start OpenXDS #"
cd /opt/openxds/
java -jar /opt/openxds/openxds-1.1.2.jar