logrotate: use systemd instead of cron

This commit is contained in:
System administrator 2014-07-10 13:11:35 +02:00 committed by Rok Garbas
parent 83f78fa82d
commit 5355d3d30b

View file

@ -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}
'';
};
};
}