1
2CGRULES.CONF(5) libcgroup Manual CGRULES.CONF(5)
3
4
5
7 cgrules.conf - libcgroup configuration file
8
10 cgrules.conf configuration file is used by libcgroups to define control
11 groups to which a process belongs.
12
13
14 The file contains a list of rules which assign to a defined group/user
15 a control group in a subsystem (or control groups in subsystems).
16
17 Rules have two formats:
18
19 <user> <controllers> <destination>
20 <user>:<process name> <controllers> <destination>
21
22 Where:
23
24 user can be:
25 - a user name
26 - a group name with @group syntax
27 - the wildcard '*', for any user or group
28 - '%', which is equivalent to "ditto" (useful for
29 multi-line rules where different cgroups need to be
30 specified for various hierarchies for a single user)
31
32 process name is optional and it can be:
33 - a process name
34 - a full command path of a process
35
36 controllers can be:
37 - comma separated controller names (no spaces) or
38 - * (for all mounted controllers)
39
40 make sure to define only controllers that are configured
41 for the matching destination in cgconfig.conf,
42 otherwise the rule can fail
43
44 destination can be:
45 - path relative to the controller hierarchy (ex. pgrp1/gid1/uid1)
46 - following strings called "templates" and will get expanded
47
48 %u username, uid if name resolving fails
49 %U uid
50 %g group name, gid if name resolving fails
51 %G gid
52 %p process name, pid if name not available
53 %P pid
54
55 '\' can be used to escape '%'
56 First rule which matches the criteria will be executed.
57
58 Any text starting with '#' is considered as a start of comment line and
59 is ignored.
60
61 If the destination contains template string, the control group can be
62 created on-fly. In time when some process wants to use the template
63 rule which leads to control group (see cgexec [22m(1)) and the control
64 group does not exist, the group is created. The template control group
65 parameters can be specified in cgconfig.conf configuration file. See
66 (cgconfig.conf [22m(5)). If the template definition is not found there
67 created group have default kernel setting.
68
69
70
71
73 student devices /usergroup/students
74 Student's processes in the 'devices' subsystem belong to the control
75 group /usergroup/students.
76
77 student:cp devices /usergroup/students/cp
78 When student executes 'cp' command, the processes in the 'devices' sub‐
79 system belong to the control group /usergroup/students/cp.
80
81 @admin * admingroup/
82 Processes started by anybody from admin group no matter in what subsys‐
83 tem belong to the control group admingroup/.
84
85 peter cpu test1/
86 % memory test2/
87 The first line says Peter's task for cpu controller belongs to test1
88 control group. The second one says Peter's tasks for memory controller
89 belong to test2/ control group.
90
91 * * default/
92 All processes in any subsystem belong to the control group default/.
93 Since the earliest matched rule is applied, it makes sense to have this
94 line at the end of the list. It will put a task which was not mentioned
95 in the previous rules to default/ control group.
96
97 @students cpu,cpuacct students/%u
98 Processes in cpu and cpuacct subsystems started by anybody from stu‐
99 dents group belong to group students/name. Where "name" is user name of
100 owner of the process.
101
102
103
104
106 /etc/cgrules.conf
107 default libcgroup configuration file
108
109
111 cgconfig.conf (5), cgclassify (1), cgred.conf (5)
112
114Linux 2009-03-10 CGRULES.CONF(5)