PostgreSQL Full Backup Bash Script

This simple Linux BASH script creates a PostgreSQL database Full-Dump to a file that can be used later by some cronjobs.

psql_garanet

GitHub https://github.com/garanet/PostgreSQL-bkp-script.git

  • Create a folder / backup with postgres user privileges and root group.
  • Place the following script named ‘full-db-psql.sh’ in the newly created folder.

#!/bin/sh
# www.garanet.net
# Identifico posizione di GZIP
GZIP="$(which gzip)"
  • Check that the script owner is root and change the permissions to 744.
  • As root, run the script with the command:: # sh full-db-psql.sh.