Skip to content

Instantly share code, notes, and snippets.

@DavidPfl
DavidPfl / db_backup.sh
Created August 9, 2025 06:52 — forked from janit/db_backup.sh
Rotating PostgreSQL Backup Script
#!/bin/bash
# for use with cron, eg:
# 0 3 * * * postgres /var/db/db_backup.sh foo_db
if [[ -z "$1" ]]; then
echo "Usage: $0 <db_name> [pg_dump args]"
exit 1
fi