first commit
This commit is contained in:
1
README.md
Normal file
1
README.md
Normal file
@@ -0,0 +1 @@
|
||||
example systemd unit : systemctl enable postgresql-dump@NAMEOFDB
|
||||
3
postgresql-dump.target
Normal file
3
postgresql-dump.target
Normal file
@@ -0,0 +1,3 @@
|
||||
[Unit]
|
||||
Description=PostgreSQL dump target
|
||||
|
||||
10
postgresql-dump.timer
Normal file
10
postgresql-dump.timer
Normal 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
14
postgresql-dump@.service
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user