cluster/services/c-f32aebf5: implement control stuff

This commit is contained in:
Max Headroom 2024-06-29 21:17:24 +02:00
parent 598f9a1a1e
commit 221a74793c

View file

@ -163,6 +163,32 @@ in
Type = "oneshot"; Type = "oneshot";
}; };
}; };
systemd.services."${cid}-control" = {
script = ''
if test -e ${home}/drive_c/spt/control/restart; then
echo Action: restart
trap 'rm -f ${home}/drive_c/spt/control/restart' EXIT
systemctl restart ${cid}.service
elif test -e ${home}/drive_c/spt/control/shutdown; then
echo Action: stop
systemctl stop ${cid}.service
else
echo Action: start
systemctl start ${cid}.service
fi
'';
unitConfig.ConditionPathExists = "${home}/drive_c/spt/control";
serviceConfig = {
Type = "oneshot";
};
};
systemd.paths."${cid}-control" = {
wantedBy = [ "paths.target" ];
pathConfig.PathChanged = "${home}/drive_c/spt/control";
};
services.openssh.extraConfig = '' services.openssh.extraConfig = ''
Match User ${cid} Match User ${cid}