cgexec
run a command in a control group
TLDR
Run in cgroup
SYNOPSIS
cgexec [OPTIONS] -g controller:cgroup command [args]
DESCRIPTION
cgexec executes a process within a specified control group (cgroup). Unlike cgclassify, which moves already-running processes, cgexec starts a new process directly inside the target cgroup from the beginning.
Cgroups allow limiting, measuring, and controlling resource usage by processes for CPU, memory, I/O, and other resources. By launching a process with cgexec, all resource constraints defined for that cgroup apply immediately from process startup, including any child processes it spawns.
cgexec is part of the libcgroup-tools package and works with cgroups v1. For cgroups v2 systems, systemd-run provides similar functionality.
PARAMETERS
-g controller:cgroup
Specify the controller and cgroup to use--sticky
Prevent cgred from moving the processControllers include:
cpu - CPU time allocation
memory - Memory usage limits
blkio - Block I/O limits
cpuset - CPU and memory node assignment
devices - Device access control
CAVEATS
The cgroup must exist before using cgexec (create with cgcreate). Multiple controllers can be specified with multiple -g options. Requires appropriate permissions or root access.
HISTORY
cgexec is part of libcgroup, providing cgroup management utilities for resource control on Linux.
SEE ALSO
cgcreate(1), cgclassify(1), cgdelete(1)
