]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Use minute precision for backups
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 2 Jan 2020 18:27:02 +0000 (19:27 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 2 Jan 2020 18:27:02 +0000 (19:27 +0100)
modules/private/databases/mariadb_replication.nix
modules/private/databases/openldap_replication.nix
modules/private/databases/postgresql_replication.nix
modules/private/databases/redis_replication.nix
modules/private/databases/utils.nix

index ca1432f87815b6bf0e6487249071a174ca81f6f7..740bdac44b3be7bdb341a31829bb14350a62e75c 100644 (file)
@@ -144,7 +144,7 @@ in
                 --gtid \
                 --master-data \
                 --flush-privileges \
-                --all-databases > ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql
+                --all-databases > ${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).sql
             '';
           u = pkgs.callPackage ./utils.nix {};
           cleanup_script = pkgs.writeScript "cleanup_mysql_${name}" (u.exponentialDumps "sql" backupDir);
index 7833e31076def0174bc7d1075c231670ec2bb6ea..2980c97bf41cb6191483e8a44de7b55a7b88612a 100644 (file)
@@ -120,7 +120,7 @@ in
           backup_script = pkgs.writeScript "backup_openldap_${name}" ''
               #!${pkgs.stdenv.shell}
 
-              ${hcfg.package}/bin/slapcat -b "${hcfg.base}" -f ${ldapConfig hcfg name} -l ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).ldif
+              ${hcfg.package}/bin/slapcat -b "${hcfg.base}" -f ${ldapConfig hcfg name} -l ${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).ldif
             '';
           u = pkgs.callPackage ./utils.nix {};
           cleanup_script = pkgs.writeScript "cleanup_openldap_${name}" (u.exponentialDumps "ldif" backupDir);
index 19ec168ede34637e2677122a50eb9521f8cc477d..7172c5e6e31f9c2046574a80b81e15571c5742c7 100644 (file)
@@ -113,7 +113,7 @@ in
 
               ${hcfg.package}/bin/psql -h ${dataDir} -c "SELECT pg_wal_replay_pause();" >/dev/null || (echo "impossible to pause replication" && false)
 
-              ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql
+              ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).sql
             '';
           u = pkgs.callPackage ./utils.nix {};
           cleanup_script = pkgs.writeScript "cleanup_postgresql_${name}" (u.keepLastNDumps "sql" backupDir 12);
index 6ec52c96fc62a6c135c338c2235c919970902643..a3fe3bb775f0f412d846bc80f7b9049035fe38f6 100644 (file)
@@ -117,7 +117,7 @@ in
               #!${pkgs.stdenv.shell}
 
               ${pkgs.coreutils}/bin/cp ${cfg.base}/${name}/redis/dump.rdb \
-                ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).rdb
+                ${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).rdb
             '';
           u = pkgs.callPackage ./utils.nix {};
           cleanup_script = pkgs.writeScript "cleanup_redis_${name}" (u.exponentialDumps "rdb" backupDir);
index 06ce2cc9e9ecca0c8e0d384d3a5a53ac54fd7d03..47988fce7ba466825539edb120d7a570172c40b6 100644 (file)
@@ -25,6 +25,6 @@
 
     cd ${backupDir}
     ${pkgs.coreutils}/bin/rm -f $(ls -1 *.${ext} | grep -v 'T22:' | sort -r | sed -e '1,12d')
-    ${pkgs.coreutils}/bin/rm -f $(ls -1 *T22*.${ext} | ${log2rotate} --skip 7 --fuzz 7 --delete --format='%Y-%m-%dT%H:%M:%S+00:00.${ext}')
+    ${pkgs.coreutils}/bin/rm -f $(ls -1 *T22*.${ext} | ${log2rotate} --skip 7 --fuzz 7 --delete --format='%Y-%m-%dT%H:%M+00:00.${ext}')
     '';
 }