2025-03-08 21:09:50 +00:00
|
|
|
[Unit]
|
|
|
|
Description=Backup PostgreSQL databases
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
|
|
|
ExecStart=/usr/local/bin/postgresql-backup.sh
|
|
|
|
EnvironmentFile=/etc/postgresql/secrets.env
|
|
|
|
EnvironmentFile=/etc/postgresql/postgresql.env
|
|
|
|
Environment=BACKUP_DIR=/srv/postgresql/backups
|
2025-03-09 14:57:59 +00:00
|
|
|
Environment=POSTGRES_HOST=systemd-postgresql
|
|
|
|
ExecStartPre=/usr/bin/mkdir -p $BACKUP_DIR
|
|
|
|
ExecStart=/usr/bin/podman run --rm --network systemd-main -v $BACKUP_DIR:/backups:z docker.io/library/postgres:17.4 pg_dumpall -U $POSTGRES_USER -h $POSTGRES_HOST -p $POSTGRES_PORT -f /backups/$(date +'%Y-%m-%d_%H-%M-%S').sql
|