init
This commit is contained in:
commit
dedd232010
4 changed files with 44 additions and 0 deletions
1
LICENSE
Normal file
1
LICENSE
Normal file
|
@ -0,0 +1 @@
|
||||||
|
"THE BEER-WARE LICENSE" (Revision 42): <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# postgresql-backup-scripts
|
||||||
|
|
||||||
|
systemd units to backup postgresql databases
|
32
postgresql-backup@.service
Normal file
32
postgresql-backup@.service
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[Unit]
|
||||||
|
Description=backup of postgresql database %i
|
||||||
|
After=postgresql.target network.target remote-fs.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=exec
|
||||||
|
ExecStart=/bin/bash -c '/usr/bin/pg_dump -c %i | bzip2 -9 > /var/backups/postgres/%i.sql.bz2'
|
||||||
|
TimeoutStopSec=0
|
||||||
|
Restart=no
|
||||||
|
|
||||||
|
User=postgres
|
||||||
|
Group=postgres
|
||||||
|
UMask=117
|
||||||
|
WorkingDirectory=/var/backups/postgres
|
||||||
|
ReadOnlyDirectories=/
|
||||||
|
ReadWritePaths=/var/backups/postgres
|
||||||
|
PrivateTmp=yes
|
||||||
|
PrivateDevices=yes
|
||||||
|
ProtectHome=yes
|
||||||
|
NoNewPrivileges=true
|
||||||
|
CapabilityBoundingSet=
|
||||||
|
MemoryDenyWriteExecute=true
|
||||||
|
ProtectKernelModules=true
|
||||||
|
ProtectKernelTunables=true
|
||||||
|
ProtectControlGroups=true
|
||||||
|
RestrictRealtime=true
|
||||||
|
RestrictNamespaces=true
|
||||||
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||||
|
ProtectSystem=full
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
8
postgresql-backup@.timer
Normal file
8
postgresql-backup@.timer
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=daily database backup of postgresql database %i
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* 2:00
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
Reference in a new issue