summary refs log tree commit diff
diff options
context:
space:
mode:
authorSystem administrator <robberer@freakmail.de>2014-07-10 13:11:35 +0200
committerRok Garbas <rok@garbas.si>2014-08-07 08:58:50 +0200
commit5355d3d30bccc6ec3881c2468234378e5e06bd57 (patch)
tree2aa3f5e878bc3da3ae8d2ce6e541171e39ff6dc8
parent83f78fa82d5a78809aae64611def88afabf5b630 (diff)
downloadnixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar.gz
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar.bz2
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar.lz
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar.xz
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.tar.zst
nixpkgs-5355d3d30bccc6ec3881c2468234378e5e06bd57.zip
logrotate: use systemd instead of cron
-rw-r--r--nixos/modules/services/logging/logrotate.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 804f9a0847f..6887ab1e805 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -8,10 +8,6 @@ let
   configFile = pkgs.writeText "logrotate.conf"
     cfg.config;
 
-  cronJob = ''
-    5 * * * * root ${pkgs.logrotate}/sbin/logrotate ${configFile}
-  '';
-
 in
 {
   options = {
@@ -33,6 +29,16 @@ in
   };
 
   config = mkIf cfg.enable {
-    services.cron.systemCronJobs = [ cronJob ];
+    systemd.services.logrotate = {
+      description   = "Logrotate Service";
+      wantedBy      = [ "multi-user.target" ];
+      startAt       = "*-*-* *:05:00";
+
+      serviceConfig.Restart = "no";
+      serviceConfig.User    = "root";
+      script = ''
+        exec ${pkgs.logrotate}/sbin/logrotate ${configFile}
+      '';
+    };
   };
 }