Guest User

Untitled

a guest
Jul 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. function dump_postgres {
  2. mkdir -p ${BACKUP_DIR}/postgres/
  3. docker ps -a --format '{{.Names}}t{{.Ports}}' | grep 5432/tcp | awk '{ print $1 }' | while read -r line; do
  4. echo "extracting database from container '${line}'"
  5. docker exec -t ${line} pg_dumpall -v --lock-wait-timeout=600 -c -U postgres > ${BACKUP_DIR}/postgres/${line}.sql
  6. done
  7. }
  8.  
  9. dump_postgres >> "${LOG}" 2>> "${ERROR}"
Add Comment
Please, Sign In to add comment