From 142559599c9034b4a93a932217f0cb95cd815114 Mon Sep 17 00:00:00 2001 From: Ilya Mukhortov Date: Sun, 9 May 2021 17:00:09 +1000 Subject: [PATCH] pass --- Readme.md | 4 +++- backup_database_sql.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 backup_database_sql.sh diff --git a/Readme.md b/Readme.md index bcf775a..0224bda 100644 --- a/Readme.md +++ b/Readme.md @@ -10,4 +10,6 @@ `> sudo apt remove golang-docker-credential-helpers` - \ No newline at end of file +> Git ignore rights + +` > git config core.fileMode false` diff --git a/backup_database_sql.sh b/backup_database_sql.sh new file mode 100644 index 0000000..9fdb9c3 --- /dev/null +++ b/backup_database_sql.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +year_month=$(date +%Y%m) +backup_date=$(date +%Y%m%d_%H%M) +backup_filename="/root/medicine-backups/${year_month}/${backup_date}_database.sql" +mkdir -p foo "/root/medicine-backups/${year_month}" +docker exec -i medicine-stack-postgres \ + pg_dump --no-owner -U postgres -F p \ + medicine > "${backup_filename}" \ + --exclude-table-data=riisz_logging --exclude-table-data=reversion_* + +echo $backup_filename