Skip to content

Instantly share code, notes, and snippets.

@mpelos
Last active April 22, 2021 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpelos/6cc9287bea5f24ba07da043630617970 to your computer and use it in GitHub Desktop.
Save mpelos/6cc9287bea5f24ba07da043630617970 to your computer and use it in GitHub Desktop.
Postgres docker container backup script
#!/bin/bash
filename=$(date +"%Y%m%d%H%M%S").out
dirname=$(date +"%Y-%m")
/usr/bin/docker exec postgres /usr/bin/pg_dumpall -U postgres > /tmp/$filename
gsutil cp /tmp/$filename gs://ebb-prod-postgres-backups/$dirname/$filename
rm -f /tmp/$filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment