[systemd-devel] Moving a service from one systemd slice to another..

Lennart Poettering lennart at poettering.net
Wed May 6 15:18:34 UTC 2020


On Mo, 04.05.20 08:31, Tomasz Torcz (tomek at pipebreaker.pl) wrote:

> On Mon, May 04, 2020 at 11:52:37AM +0530, nitish nagesh wrote:
> > Hello,
> >
> >    We have this odd want to move a daemon between different systemd slices.
> > Not sure if that's even a valid thing to do, but here is the requirement.
>
>   You can use low-level cgroup access to move it. Something like:
> systemctl show --property MainPID --value your.service >
> /sys/fs/cgroup/NEW.slice/cgroup.procs

You void your warranty if you do that. Moreover, on cgroupvs2 this
doesn't work really, since inner cgroups cannot have processes and
slices are by definition inner cgroups.

There is supposed to be only one manager of the top-level cgroup
tree. On systemd systems. If you muck with the cgroup tree anyway you
are interfering with systemd#s management and things will fall apart
sooner or later.

if you want to muck around in the cgroup tree, acquire a delegated
cgroup subtree, where you can do whatever you want.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list