1 |
6461
|
aaronmk
|
#!/bin/bash
|
2 |
4395
|
aaronmk
|
# Creates analytical DB
|
3 |
7864
|
aaronmk
|
# Usage: self [log=]
|
4 |
4395
|
aaronmk
|
|
5 |
|
|
selfDir="$(dirname -- "$0")"
|
6 |
|
|
|
7 |
6459
|
aaronmk
|
. "$selfDir/vegbien_dest"
|
8 |
|
|
|
9 |
7864
|
aaronmk
|
if test -n "${log=1}"; then # $log defaults to 1
|
10 |
|
|
exec >>"$selfDir/../inputs/analytical_db/logs/make_analytical_db.log.sql" 2>&1
|
11 |
|
|
fi
|
12 |
6047
|
aaronmk
|
|
13 |
6054
|
aaronmk
|
(set -x; date)
|
14 |
6048
|
aaronmk
|
|
15 |
7620
|
aaronmk
|
sleep 5 # wait for tnrs.make to acquire the lock if being run right after import
|
16 |
7618
|
aaronmk
|
"$selfDir/waitself" "$selfDir/../inputs/.TNRS/tnrs/tnrs.make"
|
17 |
|
|
|
18 |
14439
|
aaronmk
|
(set -x; "$selfDir/psql_verbose_vegbien" <<EOF
|
19 |
14095
|
aaronmk
|
SELECT iucn_red_list_view_modify();
|
20 |
14437
|
aaronmk
|
SELECT geoscrub_input_view_modify();
|
21 |
14095
|
aaronmk
|
|
22 |
14437
|
aaronmk
|
SELECT taxon_trait_view_modify();
|
23 |
14644
|
aaronmk
|
SELECT view_full_occurrence_individual_view_modify();
|
24 |
14437
|
aaronmk
|
SELECT provider_count_view_modify();
|
25 |
6042
|
aaronmk
|
EOF
|
26 |
7345
|
aaronmk
|
) || exit
|
27 |
6981
|
aaronmk
|
|
28 |
10865
|
aaronmk
|
remake=1 "$selfDir"/../run export_ </dev/null
|
29 |
8320
|
aaronmk
|
#"$selfDir/export_analytical_db"
|