1
0
Fork 0
medicine-config/backup_database_sql.sh

15 lines
422 B
Bash

#!/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