Skip to content

Commit

Permalink
Added command to backup all databases in docker containers
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Sep 2, 2015
1 parent 38bd727 commit ea97148
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backup_docker_databases.sh
@@ -0,0 +1,11 @@
#!/bin/bash
for NAME in `dps | grep postgis | awk '{print $13}'`;
do
# ensure we have the same version of pg_dump as on the server
# we dont know if we have 9.3 or 9.4 etc so try to copy both -one will win
docker cp $NAME:/usr/lib/postgresql/9.3/bin/pg_dump .
docker cp $NAME:/usr/lib/postgresql/9.4/bin/pg_dump .
HOST=`dipall | grep $NAME | awk '{ print $3 }'`;
echo "$NAME $HOST";
PGPASSWORD=docker ./pg_dump -Fc -f PG_${NAME}_`date +%d-%B-%Y`.dmp -U docker -h $HOST gis;
done

0 comments on commit ea97148

Please sign in to comment.