From 5c278ff4c6e5d3615f41b0c98ea4e957e42136b8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Aug 2020 20:26:10 -0300 Subject: Add poor-mans-logrotate service to gc old log files --- vps-configuration.env.nix | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'vps-configuration.env.nix') diff --git a/vps-configuration.env.nix b/vps-configuration.env.nix index 6411720..8bf103e 100644 --- a/vps-configuration.env.nix +++ b/vps-configuration.env.nix @@ -313,17 +313,17 @@ in { logrotate = { enable = false; # disabled due to extraConfig not being yet out of unstable - extraConfig = '' - compress + # extraConfig = '' + # compress - ${envsubstConfiguration.ciLogsRoot}/*/*.log { - rotate 5 - daily - olddir ${envsubstConfiguration.staticRoot}/logrorate/ - createolddir 744 andreh users - su andreh users - } - ''; + # ${envsubstConfiguration.ciLogsRoot}/*/*.log { + # rotate 5 + # daily + # olddir ${envsubstConfiguration.staticRoot}/logrorate/ + # createolddir 744 andreh users + # su andreh users + # } + # ''; }; }; @@ -350,6 +350,18 @@ in { ]); serviceConfig = { Type = "oneshot"; }; }; + "poor-mans-logrotate" = { + enable = true; + description = "Delete old CI log files"; + wantedBy = [ "multi-user.target" ]; + script = '' + pushd ${envsubstConfiguration.ciLogsRoot} + find . -type f -name '*.log' -mtime 1 -delete + find . -type d -empty -delete + ${pkgs.bash}/bin/bash ci-gen-index.sh + ''; + serviceConfig = { Type = "oneshot"; }; + }; "pires-prod" = { enable = true; # Unit -- cgit v1.2.3