logrotate: use systemd instead of cron
This commit is contained in:
parent
83f78fa82d
commit
5355d3d30b
|
@ -8,10 +8,6 @@ let
|
||||||
configFile = pkgs.writeText "logrotate.conf"
|
configFile = pkgs.writeText "logrotate.conf"
|
||||||
cfg.config;
|
cfg.config;
|
||||||
|
|
||||||
cronJob = ''
|
|
||||||
5 * * * * root ${pkgs.logrotate}/sbin/logrotate ${configFile}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
@ -33,6 +29,16 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
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}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue