From 69a416caa2bce3dc4a3aff61fb8ae955f7561e51 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 1 Feb 2022 19:25:41 +0100 Subject: Reorganise scripts --- scripts/backup/postgres_backup_v2.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 scripts/backup/postgres_backup_v2.sh (limited to 'scripts/backup/postgres_backup_v2.sh') diff --git a/scripts/backup/postgres_backup_v2.sh b/scripts/backup/postgres_backup_v2.sh new file mode 100755 index 0000000..1f06514 --- /dev/null +++ b/scripts/backup/postgres_backup_v2.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -Eeuo pipefail + +backup_folder="/opt/backup/db/$(date -u +%F)" +postgres_host="127.0.0.1" +postgres_port="5432" +filename="$(date -u +%H%M%S).psqldump" + +[ ! -d $backup_folder ] && mkdir -p $backup_folder + +pushd $backup_folder + +pg_dumpall --host=$postgres_host --port=$postgres_port -U postgres --clean --if-exists -f $filename + +popd -- cgit v1.3