--config [FILE] Read rules configuration from FILE instead of
/etc/cgrules.conf
-You can ask the daemon to reload the configuration by sending it SIGUSR2. The
-easiest way to do this is with the 'kill' command:
+You can ask the daemon to reload the rules configuration by sending it SIGUSR2.
+The easiest way to do this is with the 'kill' command:
kill -s SIGUSR2 [PID]
+You can ask the daemon to reload the templates configuration by sending it
+SIGUSR1. The easiest way to do this is with the 'kill' command:
+ kill -s SIGUSR1 [PID]
+
TESTING
=======
The program setuid (found in tests/setuid.c) can help you test the daemon. By
.I group
section.
+.I template
+section has the same structure as
+.B group
+section. Template name uses the same templates string as
+.B cgrules.conf
+destination tag (see (\fBcgrules.conf\fR (5)).
+Template definition is used as a control group definition for rules in
+\fBcgrules.conf\fR (5) with the same destination name.
+Templates does not use
+.B default
+section settings.
+
.\"********************************************"
.SH EXAMPLES
.LP
.I operator
or root can do that.
+.SS Example 7
+.LP
+The configuration file:
+
+.LP
+.RS
+.nf
+mount {
+.RS
+cpu = /mnt/cgroups/cpu;
+cpuacct = /mnt/cgroups/cpuacct;
+.RE
+}
+
+group students {
+.RS
+cpuacct{
+}
+cpu {
+}
+.RE
+}
+
+template students/%u {
+.RS
+cpuacct{
+}
+cpu {
+}
+.RE
+}
+
+mkdir /mnt/cgroups/cpu/daemons
+mkdir /mnt/cgroups/cpuacct/daemons
+.fi
+.RE
+
+The situation is the similar as in Example 4. The only difference is template,
+which is used if some rule uses "/students/%u" as a destination.
+
+
+
.SH RECOMMENDATIONS
.SS Keep hierarchies separated
Having multiple hierarchies is perfectly valid and can be useful
\fBcgexec\fR will automatically place the task in the right
cgroup based on \fB/etc/cgrules.conf\fR.
+If \fB/etc/cgrules.conf\fR configuration file is used, there can be used
+template names. Then the control group name contains
+a template in destination tag (see \fBcgrules.conf\fR (5))
+and if the cgroup does not exist in execution time,
+it is created, based on \fB/etc/cgconfig.conf\fR specification.
+If the specifications are not present the group is created with the default
+kernel values.
+
.TP
.B -h, --help
Display this help and exit.
can be:
.nf
- path relative to the controller hierarchy (ex. pgrp1/gid1/uid1)
- - following strings will get expanded
+ - following strings called "\fBtemplates\fR" and will get expanded
%u username, uid if name resolving fails
%U uid
'\\' can be used to escape '%'
.fi
-
First rule which matches the criteria will be executed.
-
Any text starting with '#' is considered as a start of comment line and is
ignored.
+If the
+.I destination
+contains
+.B template
+string, the control group can be created on-fly. In time when some process wants
+to use the template rule which leads to control group (see
+\fBcgexec\fR (1)) and the control group does not exist, the group is created. The
+template control group parameters can be specified in
+.B cgconfig.conf
+configuration file. See (\fBcgconfig.conf\fR (5)).
+If the template definition is not found there created group have default
+kernel setting.
+
+
.SH EXAMPLES
.nf
at the end of the list. It will put a task which was not mentioned in the
previous rules to default/ control group.
+.nf
+@students cpu,cpuacct students/%u
+.fi
+Processes in cpu and cpuacct subsystems started by anybody from students group
+belong to group students/name. Where "name" is user name of owner of the
+process.
+
.SH FILES
The list of rules is read during the daemon startup is are cached in the daemon's memory.
The daemon reloads the list of rules when it receives SIGUSR2 signal.
+The daemon reloads the list of templates when it receives SIGUSR1 signal.
The daemon opens a standard unix socket to receive 'sticky' requests from \fBcgexec\fR.
*
* The flags can alter the behavior of this function:
* CGFLAG_USECACHE: Use cached rules instead of parsing the config file
+ * CGFLAG_USE_TEMPLATE_CACHE: Use cached templates instead of
+ * parsing the config file
*
* This function may NOT be thread safe.
* @param uid The UID to match.
/* the prefix cgroup without template */
ret = cgroup_create_cgroup(template_group, 0);
} else {
- /* TODO: this will be a function which use
- * template to create relevant cgroup
- * now cgroup_create_cgroup is used
+ /* use template to create relevant cgroup */
ret = cgroup_config_create_template_group(
template_group, template_name,
- 0, flags);
- */
- ret = cgroup_create_cgroup(template_group, 0);
+ flags);
}
if (ret != 0) {