Last active
December 22, 2015 06:29
-
-
Save nad2000/6431169 to your computer and use it in GitHub Desktop.
One-liner loops through a PostgreSQL DB list and executes on each of them a script
This file contains hidden or 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
| for db in $(psql -t -X -h 192.168.132.111 -U postgres -d probedb -c 'SELECT erfstore_id FROM erfstores') ; do psql -X -h 192.168.132.111 -U postgres -d $db -f /build/trunk/dock/tree/customer/endace/src/bin/dbmgr/scripts/erfstoredb/da_breakdown_summary_sql.sql ; done | |
| # Or slightly more readable: | |
| export PGHOST=fin7000-4 | |
| export PGDATABASE=probedb | |
| export PGUSER=postgres | |
| cd /ginkgo/trunk/ginkgo/tree/customer/endace/src/bin/dbmgr/scripts/erfstoredb/ | |
| for db in $(psql -t -X -c 'SELECT erfstore_id FROM erfstores') erfstoredb ; do psql -X -d $db -f da_breakdown_summary_sql.sql ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment