first commit

This commit is contained in:
L. Kraven
2024-06-13 10:25:12 -07:00
commit 1f351de915
4 changed files with 28 additions and 0 deletions

1
README.md Normal file
View File

@@ -0,0 +1 @@
example systemd unit : systemctl enable postgresql-dump@NAMEOFDB

3
postgresql-dump.target Normal file
View File

@@ -0,0 +1,3 @@
[Unit]
Description=PostgreSQL dump target

10
postgresql-dump.timer Normal file
View File

@@ -0,0 +1,10 @@
[Unit]
Description=Execute PostgreSQL dumps
[Timer]
OnCalendar=daily
Unit=postgresql-dump.target
[Install]
WantedBy=multi-user.target

14
postgresql-dump@.service Normal file
View File

@@ -0,0 +1,14 @@
[Unit]
Description=PostgreSQL dump for %i
Requires=postgresql.service
[Service]
Type=simple
User=postgres
Group=postgres
ExecStartPre=/usr/bin/test -d /srv/backups/postgresql/daily
ExecStart=/bin/sh -c "/usr/bin/pg_dump -Fc %i > /srv/backups/postgresql/daily/%i.sql && /usr/bin/pg_dumpall --globals-only > /srv/backups/postgresql/daily/postgres-globals.sql"
[Install]
WantedBy=postgresql-dump.target