feat(id.tjo.space): simplify backup
This commit is contained in:
parent
71b2aad2d5
commit
c91024154e
1 changed files with 12 additions and 3 deletions
|
@ -2,11 +2,20 @@
|
|||
Description=Backup PostgreSQL databases
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/postgresql-backup.sh
|
||||
Restart=always
|
||||
Environment=PODMAN_SYSTEMD_UNIT=%n
|
||||
KillMode=mixed
|
||||
ExecStop=/usr/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStopPost=-/usr/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
Delegate=yes
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
SyslogIdentifier=%N
|
||||
|
||||
EnvironmentFile=/etc/postgresql/secrets.env
|
||||
EnvironmentFile=/etc/postgresql/postgresql.env
|
||||
Environment=BACKUP_DIR=/srv/postgresql/backups
|
||||
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
|
||||
ExecStart=/usr/bin/podman run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --network systemd-main --sdnotify=conmon -d -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
|
||||
|
|
Loading…
Reference in a new issue