aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases/utils.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/databases/utils.nix')
-rw-r--r--modules/private/databases/utils.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/private/databases/utils.nix b/modules/private/databases/utils.nix
index c296f49..06ce2cc 100644
--- a/modules/private/databases/utils.nix
+++ b/modules/private/databases/utils.nix
@@ -1,15 +1,15 @@
1{ pkgs }: 1{ pkgs }:
2{ 2{
3 keepLastNDumps = backupDir: n: '' 3 keepLastNDumps = ext: backupDir: n: ''
4 #!${pkgs.stdenv.shell} 4 #!${pkgs.stdenv.shell}
5 5
6 cd ${backupDir} 6 cd ${backupDir}
7 ${pkgs.coreutils}/bin/rm -f \ 7 ${pkgs.coreutils}/bin/rm -f \
8 $(${pkgs.coreutils}/bin/ls -1 *.sql \ 8 $(${pkgs.coreutils}/bin/ls -1 *.${ext} \
9 | ${pkgs.coreutils}/bin/sort -r \ 9 | ${pkgs.coreutils}/bin/sort -r \
10 | ${pkgs.gnused}/bin/sed -e '1,${builtins.toString n}d') 10 | ${pkgs.gnused}/bin/sed -e '1,${builtins.toString n}d')
11 ''; 11 '';
12 exponentialDumps = backupDir: let 12 exponentialDumps = ext: backupDir: let
13 log2rotateSrc = builtins.fetchGit { 13 log2rotateSrc = builtins.fetchGit {
14 url = "https://github.com/avian2/pylog2rotate"; 14 url = "https://github.com/avian2/pylog2rotate";
15 ref = "master"; 15 ref = "master";
@@ -24,7 +24,7 @@
24 #!${pkgs.stdenv.shell} 24 #!${pkgs.stdenv.shell}
25 25
26 cd ${backupDir} 26 cd ${backupDir}
27 ${pkgs.coreutils}/bin/rm -f $(ls -1 *.sql | grep -v 'T22:' | sort -r | sed -e '1,12d') 27 ${pkgs.coreutils}/bin/rm -f $(ls -1 *.${ext} | grep -v 'T22:' | sort -r | sed -e '1,12d')
28 ${pkgs.coreutils}/bin/rm -f $(ls -1 *T22*.sql | ${log2rotate} --skip 7 --fuzz 7 --delete --format='%Y-%m-%dT%H:%M:%S+00:00.sql') 28 ${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}')
29 ''; 29 '';
30} 30}