Wrapper to run a command in a temporary cgroup

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

 



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).

If there is no such a tool, can someone give me some hints on how to implement one? Is it possible in Shell or Perl? Or do I need to reach to C / C++? Is there anything similar I could take as basis?

Apologies if this is not the right mailing list. I could not find anywhere else to ask about cgroups matters.

Regards,
  rdiez



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux