Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Corralling Processes on Linux



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?




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org