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.



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

# 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