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
|
}: let
|
||||||
inherit (_config.virtualisation.oci-containers) backend;
|
inherit (_config.virtualisation.oci-containers) backend;
|
||||||
in {
|
in {
|
||||||
virtualisation.oci-containers.containers.${name} = {
|
virtualisation.oci-containers.containers."mc-${name}" = {
|
||||||
image = "itzg/minecraft-server:${tag}";
|
image = "itzg/minecraft-server:${tag}";
|
||||||
ports = ["${builtins.toString port}:25565"] ++ extraPorts;
|
ports = ["${builtins.toString port}:25565"] ++ extraPorts;
|
||||||
volumes = ["${dataDir}:/data"];
|
volumes = ["${dataDir}:/data"];
|
||||||
|
|
|
@ -59,18 +59,15 @@ in {
|
||||||
|
|
||||||
systemd.services.restart-minecraft-servers = {
|
systemd.services.restart-minecraft-servers = {
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
script = ''
|
startAt = "*-*-* 05:00:00";
|
||||||
${lib.getExe' pkgs.systemd "systemctl"} restart ${backend}-*.service
|
|
||||||
'';
|
|
||||||
serviceConfig.Type = "oneshot";
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.timers.restart-minecraft-servers = {
|
script = ''
|
||||||
wantedBy = ["timers.target"];
|
${lib.getExe' pkgs.systemd "systemctl"} restart ${backend}-mc-*.service
|
||||||
timerConfig = {
|
'';
|
||||||
OnCalendar = "*-*-* 05:00:00";
|
|
||||||
Persistent = true;
|
serviceConfig = {
|
||||||
Unit = "restart-minecraft-servers.service";
|
Type = "oneshot";
|
||||||
|
DynamicUser = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue