Skip to content

Instantly share code, notes, and snippets.

@userimack
Created March 21, 2020 13:45
Show Gist options
  • Save userimack/87cbe4f16120c82361463009c1d2f360 to your computer and use it in GitHub Desktop.
Save userimack/87cbe4f16120c82361463009c1d2f360 to your computer and use it in GitHub Desktop.
postgresql db dump command - it will dump the database and gzip it before saving it
#!/bin/bash
echo "Starting database backup.."
pg_dump -Fc --no-acl --no-owner \
<Database Name> \
| gzip > "<dump name>-$(date +%Y%m%d%H%M%S).pgdump.gz"
echo "Backup completed.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment