lxc-containers: add experimental lxc-reload on system change
This commit is contained in:
parent
fd8cb77b40
commit
9fe5709976
|
@ -170,7 +170,19 @@ in
|
||||||
|
|
||||||
systemd.targets.lxc-containers = {
|
systemd.targets.lxc-containers = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
wants = map (ctName: "lxc@${ctName}.service")
|
wants = builtins.concatMap (ctName: [ "lxc@${ctName}.service" "lxc-reload@${ctName}.path" ])
|
||||||
(builtins.attrNames containers);
|
(builtins.attrNames containers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.paths."lxc-reload@" = {
|
||||||
|
pathConfig = {
|
||||||
|
PathChanged = "/var/lib/lxc/%i/rootfs/init";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemd.services."lxc-reload@" = {
|
||||||
|
requires = [ "lxc@%i.service" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
scriptArgs = "%i";
|
||||||
|
script = "/run/current-system/systemd/bin/systemctl reload lxc@$1.service || true";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue