create stanza

This commit is contained in:
2025-12-20 21:02:52 +00:00
parent 83b61c1910
commit 07a8176e7f

View File

@@ -52,11 +52,28 @@
pg1-user=postgres
'';
systemd.services.pgbackrest-backup = {
description = "pgBackRest Full Backup";
systemd.services.pgbackrest-stanza-create = {
description = "pgBackRest Stanza Create";
after = ["postgresql.service"];
requires = ["postgresql.service"];
path = [pkgs.pgbackrest];
serviceConfig = {
Type = "oneshot";
User = "postgres";
EnvironmentFile = "/run/secrets/mindy-pgbackrest";
RemainAfterExit = true;
};
script = ''
pgbackrest --stanza=main stanza-create || true
'';
};
systemd.services.pgbackrest-backup = {
description = "pgBackRest Full Backup";
after = ["postgresql.service" "pgbackrest-stanza-create.service"];
requires = ["postgresql.service"];
wants = ["pgbackrest-stanza-create.service"];
path = [pkgs.pgbackrest];
serviceConfig = {
Type = "oneshot";
User = "postgres";
@@ -78,8 +95,9 @@
systemd.services.pgbackrest-backup-diff = {
description = "pgBackRest Differential Backup";
after = ["postgresql.service"];
after = ["postgresql.service" "pgbackrest-stanza-create.service"];
requires = ["postgresql.service"];
wants = ["pgbackrest-stanza-create.service"];
path = [pkgs.pgbackrest];
serviceConfig = {
Type = "oneshot";