cluster/services/c-f32aebf5: implement control stuff
This commit is contained in:
parent
598f9a1a1e
commit
221a74793c
1 changed files with 26 additions and 0 deletions
|
@ -163,6 +163,32 @@ in
|
|||
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 = ''
|
||||
Match User ${cid}
|
||||
|
|
Loading…
Reference in a new issue