Use a timer instead of a cron job for Nix log compression
Also, do it only once a week.
Eelco Dolstra committed
Nov 12, 2014 at 14:05 UTC
c89e14c48c72e54384d3b6f769657ba4d0edb8b1
2 files changed
+9
-7
delft/hydra-module.nix
-7
@@ -235,15 +235,8 @@ in
235
systemctl stop hydra-evaluator
236
fi
237
'';
238
- compressLogs = pkgs.writeScript "compress-logs"
239
- ''
240
- #! /bin/sh -e
241
- touch -d 'last month' r
242
- find /nix/var/log/nix/drvs -type f -a ! -newer r -name '*.drv' | xargs bzip2 -v
243
- '';
238
in
239
[ "*/5 * * * * root ${checkSpace} &> ${cfg.baseDir}/data/checkspace.log"
246
- "15 5 * * * root ${compressLogs} &> ${cfg.baseDir}/data/compress.log"
240
"15 2,14 * * * root ${pkgs.systemd}/bin/systemctl start hydra-update-gc-roots.service"
241
];
242
delft/lucifer.nix
+9
@@ -212,4 +212,13 @@
212
nix.sshServe.enable = true;
213
nix.sshServe.keys = with import ../ssh-keys.nix; [ eelco rob ];
214
215
+ systemd.services.nix-compress-logs =
216
+ { script =
217
+ ''
218
+ touch -d 'last month' /root/.r
219
+ find /nix/var/log/nix/drvs -type f -a ! -newer /root/.r -name '*.drv' | xargs bzip2 -v
220
+ '';
221
+ startAt = "Sun 01:45";
222
+ };
223
+
224
}