1
0
Fork 0
medicine-config/cron-tasks/backup_database_medicine.sh

18 lines
455 B
Bash
Executable File

#!/bin/sh
set -e
cd /root/medicine-backups/
weekday=$(date +%u)
backup_filename="medicine_${weekday}.sql"
archive_filename="medicine_${weekday}.tar.gz"
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_*
cd /root/medicine-backups/
rm archive_filename || true
tar -czf archive_filename backup_filename
rm backup_filename