From 7c059af8158354397885b720395b40976d9e351d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 15 Feb 2019 09:48:28 +0100 Subject: Do stats computation sequentially MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do it now sequentially rather than relying on the previous job taking less than one minute to finish (which is unlikely as the size of the logs grow) Goaccess doesn’t like to be started twice concurrently, so sequential is needed Fixes https://git.immae.eu/mantisbt/view.php?id=110 --- nixops/modules/websites/commons/stats.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixops/modules/websites/commons/stats.nix b/nixops/modules/websites/commons/stats.nix index b5bf0e0..e2c1e62 100644 --- a/nixops/modules/websites/commons/stats.nix +++ b/nixops/modules/websites/commons/stats.nix @@ -55,8 +55,15 @@ in { goaccess $TMPFILE --no-progress -o /var/lib/goaccess/${domain}/index.html -p ${conf} ''; in "${d}/bin/stats-${domain}"; + allStats = sites: pkgs.writeScript "stats" '' + #!${pkgs.stdenv.shell} + + ${builtins.concatStringsSep "\n" (map (v: stats v.name v.conf) sites)} + ''; in - pkgs.lib.lists.imap0 (i: v: "${toString (i+5)} 0 * * * root ${stats v.name v.conf}") cfg.sites; + [ + "5 0 * * * root ${allStats cfg.sites}" + ]; }; system.activationScripts.goaccess = '' -- cgit v1.2.3