-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
964562b
commit 0ef18cc
Showing
4 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cat erddap_create_views.sh | ||
#!/bin/sh | ||
|
||
# | ||
# Run the views (.sql files) defined in the hakai-datases repo 'views' folder | ||
# Each view corresponds with an erddap dataset | ||
# | ||
# Runs nightly right after the SN views are re-created | ||
# | ||
# Contact Nate if there are issues with this script | ||
|
||
git --git-dir hakai-erddap/.git pull | ||
|
||
export PGUSER=$(cat .pguser) | ||
export PGPASSWORD=$(cat .pgpass) | ||
export PGHOST=$(cat .pghost) | ||
export PGDATABASE=$(cat .pgdb) | ||
export QUIET=1 | ||
{ | ||
echo "SET ROLE hakai_admin;" | ||
for f in $HOME/hakai-erddap/views/*.sql;do echo "BEGIN;";cat $f;echo "COMMIT;";done; | ||
echo "GRANT SELECT ON ALL TABLES IN SCHEMA erddap TO hakai_erddap_user;" | ||
} | PGOPTIONS='--client-min-messages=warning' psql -X --quiet --pset pager=off >/dev/null |