Hi all:

I am looking for a wrapper script like this:

run-on-temporary-cgroup.sh cmd arg1 ... argn.

The tool should create a temporary cgroup, run the process inside, and return 
the same exit code as the user command.

I may want to limit the amount of memory the cgroup is allowed to consume. But 
more importantly, I want the tool to return when all processes in the cgroup 
(the user command an any children) have already terminated. This is apparently 
not so easy to achieve without cgroups.

Those requirements are similar to what systemd-run does, but I need an 
alternative which does not depend on systemd.

Even if you have systemd, systemd-run is rather convenient, but it is somewhat 
heavy weight and it has issues with some signals (like SIGTERM), and with 
escaping/quoting, depending on the mode (--scope vs --wait).

I looked at libcgroup, and cgexec comes close, but it is described as follows:

  Use command line tool "cgexec" to launch the task in right cgroup.

  To use "cgexec" to place the task in right cgroup: [...]

So it does not look like it would automatically create a temporary cgroup, and 
delete it at the end. Or am I missing something?

Otherwise, I could write my own script, but I do not know much about cgroups 
yet. How could I approach this task? Can you create a cgroup without being 
root? Is there an example script somewhere to get started?

Thanks in advance,
  rdiez


_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to