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 destination can be:
41 - path relative to the controller hierarchy (ex. pgrp1/gid1/uid1)
42 - following strings called "templates" and will get expanded
43
44 %u username, uid if name resolving fails
45 %U uid
46 %g group name, gid if name resolving fails
47 %G gid
48 %p process name, pid if name not available
49 %P pid
50
51 '\' can be used to escape '%'
52 First rule which matches the criteria will be executed.
53
54 Any text starting with '#' is considered as a start of comment line and
55 is ignored.
56
57 If the destination contains template string, the control group can be
58 created on-fly. In time when some process wants to use the template
59 rule which leads to control group (see cgexec [22m(1)) and the control
60 group does not exist, the group is created. The template control group
61 parameters can be specified in cgconfig.conf configuration file. See
62 (cgconfig.conf [22m(5)). If the template definition is not found there
63 created group have default kernel setting.
64
65
66
67
69 student devices /usergroup/students
70 Student's processes in the 'devices' subsystem belong to the control
71 group /usergroup/students.
72
73 student:cp devices /usergroup/students/cp
74 When student executes 'cp' command, the processes in the 'devices' sub‐
75 system belong to the control group /usergroup/students/cp.
76
77 @admin * admingroup/
78 Processes started by anybody from admin group no matter in what subsys‐
79 tem belong to the control group admingroup/.
80
81 peter cpu test1/
82 % memory test2/
83 The first line says Peter's task for cpu controller belongs to test1
84 control group. The second one says Peter's tasks for memory controller
85 belong to test2/ control group.
86
87 * * default/
88 All processes in any subsystem belong to the control group default/.
89 Since the earliest matched rule is applied, it makes sense to have this
90 line at the end of the list. It will put a task which was not mentioned
91 in the previous rules to default/ control group.
92
93 @students cpu,cpuacct students/%u
94 Processes in cpu and cpuacct subsystems started by anybody from stu‐
95 dents group belong to group students/name. Where "name" is user name of
96 owner of the process.
97
98
99
100
102 /etc/cgrules.conf
103 default libcgroup configuration file
104
105
107 cgconfig.conf (5), cgclassify (1), cgred.conf (5)
108
110Linux 2009-03-10 CGRULES.CONF(5)