fix(etna): replace systemd timers by startAt
This commit is contained in:
parent
0ff6938411
commit
f23ef21730
2 changed files with 9 additions and 12 deletions
|
@ -37,7 +37,7 @@
|
|||
}: let
|
||||
inherit (_config.virtualisation.oci-containers) backend;
|
||||
in {
|
||||
virtualisation.oci-containers.containers.${name} = {
|
||||
virtualisation.oci-containers.containers."mc-${name}" = {
|
||||
image = "itzg/minecraft-server:${tag}";
|
||||
ports = ["${builtins.toString port}:25565"] ++ extraPorts;
|
||||
volumes = ["${dataDir}:/data"];
|
||||
|
|
|
@ -59,18 +59,15 @@ in {
|
|||
|
||||
systemd.services.restart-minecraft-servers = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
script = ''
|
||||
${lib.getExe' pkgs.systemd "systemctl"} restart ${backend}-*.service
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
startAt = "*-*-* 05:00:00";
|
||||
|
||||
systemd.timers.restart-minecraft-servers = {
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 05:00:00";
|
||||
Persistent = true;
|
||||
Unit = "restart-minecraft-servers.service";
|
||||
script = ''
|
||||
${lib.getExe' pkgs.systemd "systemctl"} restart ${backend}-mc-*.service
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
DynamicUser = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue