1
|
#!/bin/bash
|
2
|
# Creates analytical DB
|
3
|
# Usage: self [log=]
|
4
|
|
5
|
selfDir="$(dirname -- "$0")"
|
6
|
|
7
|
. "$selfDir/vegbien_dest"
|
8
|
|
9
|
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
|
|
13
|
(set -x; date)
|
14
|
|
15
|
sleep 5 # wait for tnrs.make to acquire the lock if being run right after import
|
16
|
"$selfDir/waitself" "$selfDir/../inputs/.TNRS/tnrs/tnrs.make"
|
17
|
|
18
|
(set -x; "$selfDir/psql_verbose_vegbien" <<EOF
|
19
|
SELECT iucn_red_list_view_modify();
|
20
|
SELECT geoscrub_input_view_modify();
|
21
|
|
22
|
SELECT taxon_trait_view_modify();
|
23
|
SELECT analytical_stem_view_modify();
|
24
|
SELECT provider_count_view_modify();
|
25
|
EOF
|
26
|
) || exit
|
27
|
|
28
|
remake=1 "$selfDir"/../run export_ </dev/null
|
29
|
#"$selfDir/export_analytical_db"
|