[Discuss] Corralling Processes on Linux
Kent Borg
kentborg at borg.org
Sat Jan 20 16:42:01 EST 2018
On 01/20/2018 04:09 PM, Chuck Anderson wrote:
> systemd has a few features which might work well for your use case:
> https://linuxaria.com/article/how-to-manage-processes-with-cgroup-on-systemd
>
To heck with systemd, it looks like control groups will do the trick!
- create a control group, details about all the switches unclear but
this seems to at least come close:
sudo cgcreate -t kentborg:kentborg -g cpu:foogroup # Yes, root needs
to do that, but it's one-off (per boot?).
- create my processes in that group:
$ cgexec -g cpu:foogroup watch ls &
[1] 16137
$ cgexec -g cpu:foogroup watch ps &
[2] 16162
- Find them in a pseudo file:
$ cat /sys/fs/cgroup/cpu/foogroup/tasks
16137
16162
- fg and kill one, check again:
$ cat /sys/fs/cgroup/cpu/foogroup/tasks
16137
Cool!
Thanks,
-kb
P.S. Less important, but could be useful: Anyone know if Mac OS has
something like this?
More information about the Discuss
mailing list