diff options
author | EuAndreh <eu@euandre.org> | 2020-08-30 20:26:10 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-30 20:44:36 -0300 |
commit | 5c278ff4c6e5d3615f41b0c98ea4e957e42136b8 (patch) | |
tree | a52e8978bb99a6eebd431cdf95c610d84d674247 | |
parent | Add prototype of logrotate configuration (diff) | |
download | server-5c278ff4c6e5d3615f41b0c98ea4e957e42136b8.tar.gz server-5c278ff4c6e5d3615f41b0c98ea4e957e42136b8.tar.xz |
Add poor-mans-logrotate service to gc old log files
-rw-r--r-- | vps-configuration.env.nix | 32 |
1 files changed, 22 insertions, 10 deletions
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 |