Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91338645
configure_hive.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 10, 03:29
Size
4 KB
Mime Type
text/x-shellscript
Expires
Tue, Nov 12, 03:29 (2 d)
Engine
blob
Format
Raw Data
Handle
22243784
Attached To
R2664 SHRINE MedCo Fork
configure_hive.sh
View Options
#!/bin/bash
echo
"[i2b2/configure_hive.sh] Begin."
#########
# I2B2 DB (datasource) lookup
#
#########
source
./i2b2.rc
#########
echo
"[i2b2/configure_hive.sh] Configuring ONT_DB_LOOKUP, CRC_DB_LOOKUP"
require
"${I2B2_DOMAIN_ID}"
"I2B2_DOMAIN_ID must be set"
require
"${I2B2_DB_SHRINE_ONT_USER}"
"I2B2_DB_SHRINE_ONT_USER must be set"
require
"${I2B2_DB_SHRINE_ONT_DATASOURCE_NAME}"
"I2B2_DB_SHRINE_ONT_DATASOURCE_NAME must be set"
require
"${I2B2_DB_CRC_DATASOURCE_NAME}"
"I2B2_DB_CRC_DATASOURCE_NAME must be set"
#ITL MSSQL variables
require
"${I2B2_DB_SCHEMA}"
"I2B2_DB_SCHEMA must be set"
require
"${I2B2_DB_HIVE_SERVER}"
"I2B2_DB_HIVE_SERVER must be set"
require
"${I2B2_DB_HIVE_USER}"
"I2B2_DB_HIVE_USER must be set"
require
"${I2B2_DB_HIVE_PASSWORD}"
"I2B2_DB_HIVE_PASSWORD must be set"
require
"${I2B2_DB_HIVE_DATABASE}"
"I2B2_DB_HIVE_DATABASE must be set"
require
"${I2B2_DB_SHRINE_ONT_DATABASE}"
"I2B2_DB_SHRINE_ONT_DATABASE must be set"
require
"${I2B2_DB_CRC_DATABASE}"
"I2B2_DB_CRC_DATABASE must be set"
interpolate_file ./skel/configure_hive_db_lookups.sql
"I2B2_DOMAIN_ID"
"$I2B2_DOMAIN_ID"
|
\
interpolate
"I2B2_DB_SCHEMA"
"$I2B2_DB_SCHEMA"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_DATABASE"
"$I2B2_DB_SHRINE_ONT_DATABASE"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_USER"
"$I2B2_DB_SHRINE_ONT_USER"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_DATASOURCE_NAME"
"$I2B2_DB_SHRINE_ONT_DATASOURCE_NAME"
|
\
interpolate
"I2B2_DB_CRC_DATABASE"
"$I2B2_DB_CRC_DATABASE"
|
\
interpolate
"I2B2_DB_CRC_DATASOURCE_NAME"
"$I2B2_DB_CRC_DATASOURCE_NAME"
> configure_hive_db_lookups.sql.interpolated
#sudo -u postgres psql ${I2B2_DB_HIVE_USER} < configure_hive_db_lookups.sql.interpolated
#ITL modified to use jdbc to execute file against MSSQL server
java -cp ../../:../../sqljdbc.jar tsql configure_hive_db_lookups.sql.interpolated
\
${
I2B2_DB_HIVE_SERVER
}
${
I2B2_DB_HIVE_USER
}
${
I2B2_DB_HIVE_PASSWORD
}
${
I2B2_DB_HIVE_DATABASE
}
echo
"[i2b2/configure_hive.sh] Backing up ont-ds.xml"
mkdir -p backup
(
!
[
-d backup
])
&&
(
echo
"Couldn't create backup/"
;
exit
-1
)
cp
${
JBOSS_DEPLOY_DIR
}
/ont-ds.xml backup/ont-ds.xml
(
!
[
-f backup/ont-ds.xml
])
&&
(
echo
"Couldn't back up ont-ds.xml"
;
exit
-1
)
echo
"[i2b2/configure_hive.sh] Configuring SHRINE ont-ds.xml"
require
"$I2B2_DB_HIVE_DATASOURCE_NAME"
"I2B2_DB_HIVE_DATASOURCE_NAME must be set"
require
"$I2B2_DB_HIVE_JDBC_URL"
"I2B2_DB_HIVE_JDBC_URL must be set"
require
"$I2B2_DB_HIVE_USER"
"I2B2_DB_HIVE_USER must be set"
require
"$I2B2_DB_HIVE_PASSWORD"
"I2B2_DB_HIVE_PASSWORD must be set"
require
"$I2B2_DB_ONT_DATASOURCE_NAME"
"I2B2_DB_ONT_DATASOURCE_NAME must be set"
require
"$I2B2_DB_ONT_JDBC_URL"
"I2B2_DB_ONT_JDBC_URL must be set"
require
"$I2B2_DB_ONT_USER"
"I2B2_DB_ONT_USER must be set"
require
"$I2B2_DB_HIVE_PASSWORD"
"I2B2_DB_HIVE_PASSWORD must be set"
require
"$I2B2_DB_SHRINE_ONT_DATASOURCE_NAME"
"I2B2_DB_SHRINE_ONT_DATASOURCE_NAME must be set"
require
"$I2B2_DB_SHRINE_ONT_JDBC_URL"
"I2B2_DB_SHRINE_ONT_JDBC_URL must be set"
require
"$I2B2_DB_SHRINE_ONT_USER"
"I2B2_DB_SHRINE_ONT_USER must be set"
require
"$I2B2_DB_SHRINE_ONT_PASSWORD"
"I2B2_DB_SHRINE_ONT_PASSWORD must be set"
interpolate_file ./skel/ont-ds.xml
"I2B2_DB_HIVE_DATASOURCE_NAME"
"$I2B2_DB_HIVE_DATASOURCE_NAME"
|
\
interpolate
"I2B2_DB_HIVE_JDBC_URL"
"$I2B2_DB_HIVE_JDBC_URL"
|
\
interpolate
"I2B2_DB_HIVE_USER"
"$I2B2_DB_HIVE_USER"
|
\
interpolate
"I2B2_DB_HIVE_PASSWORD"
"$I2B2_DB_HIVE_PASSWORD"
|
\
interpolate
"I2B2_DB_ONT_DATASOURCE_NAME"
"$I2B2_DB_ONT_DATASOURCE_NAME"
|
\
interpolate
"I2B2_DB_ONT_JDBC_URL"
"$I2B2_DB_ONT_JDBC_URL"
|
\
interpolate
"I2B2_DB_ONT_USER"
"$I2B2_DB_ONT_USER"
|
\
interpolate
"I2B2_DB_ONT_PASSWORD"
"$I2B2_DB_ONT_PASSWORD"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_DATASOURCE_NAME"
"$I2B2_DB_SHRINE_ONT_DATASOURCE_NAME"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_JDBC_URL"
"$I2B2_DB_SHRINE_ONT_JDBC_URL"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_USER"
"$I2B2_DB_SHRINE_ONT_USER"
|
\
interpolate
"I2B2_DB_SHRINE_ONT_PASSWORD"
"$I2B2_DB_SHRINE_ONT_PASSWORD"
> ont-ds.xml.interpolated
echo
"[i2b2/configure_hive.sh] Copying SHRINE ont-ds.xml"
cp ont-ds.xml.interpolated
${
JBOSS_DEPLOY_DIR
}
/ont-ds.xml
(
!
[
-f
${
JBOSS_DEPLOY_DIR
}
/ont-ds.xml
])
&&
(
echo
"Couldn't copy ont-ds.xml to JBoss dir"
;
exit
-1
)
[
"`diff ont-ds.xml.interpolated ${JBOSS_DEPLOY_DIR}/ont-ds.xml`"
!
=
""
]
&&
(
echo
"Couldn't copy ont-ds.xml to JBoss dir"
;
exit
-1
)
echo
"[i2b2/configure_hive.sh] Done."
Event Timeline
Log In to Comment