CGEXEC(1)
π CGEXEC β the libcgroup page, bestie edition π
okay so this is cgexec, straight out of the libcgroup Manual. it's the little command that yeets your task into whatever control groups you tell it to. let's get into it π«Ά
β¨ NAME β¨
cgexec β run the task in given control groups
πΈ SYNOPSIS πΈ
cgexec [-h] [-b] [-g <controllers>:<path>] [--sticky] command
[arguments]
π¦ DESCRIPTION π¦
so basically, the cgexec program executes the task command with arguments arguments in the given control groups. that's the whole vibe. β¨
-bβ this one ignores the default systemd delegated hierarchy path and constructs the path of the control groups relative to the cgroup root hierarchy. lowkey a whole different map. πΊοΈ-g <controllers>:<path>β defines the control groups in which the task will be run.controllersis a list of controllers andpathis the relative path to control groups in the given controllers list.
this flag can be used multiple times to define multiple pairs of lists of controllers and relative paths. and instead of the list of all mounted controllers, the wildcard * can be used. π
if this option is not used, cgexec will automatically place the task in the right cgroup based on /etc/cgrules.conf.
if the /etc/cgrules.conf configuration file is used, there can be used template names. then the control group name contains a template in the destination tag (see cgrules.conf (5)) and if the cgroup does not exist in execution time, it is created, based on /etc/cgconfig.conf specification. if the specifications are not present the group is created with the default kernel values. no cap, that's the whole flow. π§
-h,--helpβ display this help and exit. the classic escape hatch, we love her. π-rβ replaces systemd scope's idle process with the task command. π--stickyβ if you're running the taskcommandwith this option, the daemon of servicecgred(cgrulesengdprocess) does not change both the task of the command and the child tasks. without this option, the daemon does not change the task of the command but it changes the child tasks to the right cgroup based on/etc/cgrules.confautomatically. so like... sticky = nobody gets moved, no sticky = the children get rehomed without asking. π
π EXAMPLES π
these are literally verbatim, copy-paste energy only, bestie.
cgexec -g *:test1 ls
runs command ls in control group test1 in all mounted controllers. π
cgexec -g cpu,memory:test1 ls -l
runs command ls -l in control group test1 in controllers cpu and memory. β
cgexec -g cpu,memory:test1 -g swap:test2 ls -l
runs command ls -l in control group test1 in controllers cpu and memory and control group test2 in controller swap. π₯
π ENVIRONMENT VARIABLES π
CGROUP_LOGLEVELβ controls verbosity of the tool. allowed values areDEBUG,INFO,WARNINGorERROR. so pick your volume: yapping, normal, slightly concerned, or full panic. π
π FILES π
/etc/cgrules.confβ default libcgroup configuration file. the main character file, fr fr. π
π SEE ALSO π
cgrules.conf(5)
and that's the page!! this was the libcgroup Manual version, dated 2009-03-15, tagged CGEXEC(1), and it says Linux at the bottom β so yeah, the OG shipped on Linux back in 2009 and it's still out here doing its thing. periodt. πβ¨ππ¦
π¦ where this page comes from
- debian trixie: cgroup-tools 3.1.0-2+b2 Β· LGPL-2.1-only
- ubuntu questing: cgroup-tools 3.1.0-2
- ubuntu resolute: cgroup-tools 3.1.0-2build1 Β· LGPL-2.1-only
- ubuntu stonking: cgroup-tools 3.2.0-1 Β· LGPL-2.1-only
- Copyright (C) 2009 Red Hat, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms