forked from PnX-SI/gn_module_import
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_db.sh
executable file
·31 lines (24 loc) · 988 Bytes
/
install_db.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
29
30
31
#!/bin/bash
. config/settings.ini
# Create log folder in module folders if it don't already exists
if [ ! -d 'var' ]
then
mkdir var
fi
if [ ! -d 'var/log' ]
then
mkdir var/log
fi
touch config/conf_gn_module.toml
echo -n "create tables and functions for gn_module_import "
export PGPASSWORD=$user_pg_pass; psql -h $db_host -p $db_port -U $user_pg -d $db_name -b -f data/import_db.sql &>> var/log/install_gn_imports.log
return_value=$?
#check_psql_status $return_value
echo -n "insert essential data"
export PGPASSWORD=$user_pg_pass; psql -h $db_host -p $db_port -U $user_pg -d $db_name -b -f data/data.sql &>> var/log/install_gn_import_archives.log
return_value=$?
#check_psql_status $return_value
echo -n "create default mapping for GeoNature extracted data"
export PGPASSWORD=$user_pg_pass; psql -h $db_host -p $db_port -U $user_pg -d $db_name -b -f data/default_mappings_data.sql &>> var/log/install_gn_import_archives.log
return_value=$?
#check_psql_status $return_value