Created
January 8, 2019 18:32
-
-
Save dlangille/c548cf845b36a6226480022a09098b73 to your computer and use it in GitHub Desktop.
permissions for database backup
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
#!/bin/sh | |
# these permissions only need to be run once, and then it allows rsyncer to backup the databases | |
SCHEMAS="auth base conflict custom log momomoto public release" | |
DATABASES="pentabarf_bsdcan pentabarf_pgcon" | |
for schema in ${SCHEMAS} | |
do | |
for database in ${DATABASES} | |
do | |
echo echo \""grant usage on schema ${schema} to rsyncer;\"" \| psql ${database} | |
echo "grant usage on schema ${schema} to rsyncer;" |psql ${database} | |
echo echo \""grant select on all tables in schema ${schema} to rsyncer;\"" \| psql ${database} | |
echo "grant select on all tables in schema ${schema} to rsyncer;" | psql ${database} | |
echo echo \""grant select on all sequences in schema ${schema} to rsyncer;\"" \| psql ${database} | |
echo "grant select on all sequences in schema ${schema} to rsyncer;" | psql ${database} | |
done | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment