aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases/postgresql_replication.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/databases/postgresql_replication.nix')
-rw-r--r--modules/private/databases/postgresql_replication.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/private/databases/postgresql_replication.nix b/modules/private/databases/postgresql_replication.nix
index 145fcac..cc32c2b 100644
--- a/modules/private/databases/postgresql_replication.nix
+++ b/modules/private/databases/postgresql_replication.nix
@@ -115,9 +115,11 @@ in
115 115
116 ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql 116 ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql
117 ''; 117 '';
118 u = pkgs.callPackage ./utils.nix {};
119 cleanup_script = pkgs.writeScript "cleanup_postgresql_${name}" (u.keepLastNDumps backupDir 12);
118 in [ 120 in [
119 "0 22,4,10,16 * * * postgres ${backup_script}" 121 "0 22,4,10,16 * * * postgres ${backup_script}"
120 "0 3 * * * postgres ${pkgs.coreutils}/bin/rm -f $(${pkgs.coreutils}/bin/ls -1 ${backupDir}/*.sql | ${pkgs.coreutils}/bin/sort -r | ${pkgs.gnused}/bin/sed -e '1,12d')" 122 "0 3 * * * postgres ${cleanup_script}"
121 ]) cfg.hosts); 123 ]) cfg.hosts);
122 }; 124 };
123 125