Skip to content

Instantly share code, notes, and snippets.

@glebov21
Last active March 4, 2021 08:02
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 glebov21/fe885b07e5174c642276cabcd796b3dc to your computer and use it in GitHub Desktop.
Save glebov21/fe885b07e5174c642276cabcd796b3dc to your computer and use it in GitHub Desktop.
pgdump
#!/bin/sh
pathB=/data/pgbackup
dbUser=postgres
database=aerodb
mkdir -p $pathB
chmod 775 -R $pathB
find $pathB -mtime +61 -delete
su $dbUser -c "/usr/bin/pg_dumpall --database=$database | gzip > $pathB/pgsql_$(date -u "+%Y-%m-%d").sql.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment