Init conifg
This commit is contained in:
commit
2112d7e620
6 changed files with 105 additions and 0 deletions
17
Makefile
Normal file
17
Makefile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
CONFIG=cgconfig.conf cgred.conf cgrules.conf
|
||||||
|
CONFIG_DIR=/etc
|
||||||
|
|
||||||
|
SERVICES=cgconfigparser.service cgrulesgend.service
|
||||||
|
SYSTEMD_DIR=/lib/systemd/system
|
||||||
|
|
||||||
|
install:
|
||||||
|
cp $(CONFIG) $(CONFIG_DIR)
|
||||||
|
cp $(SERVICES) $(SYSTEMD_DIR)
|
||||||
|
$(foreach service,$(SERVICES), systemctl enable $(service);)
|
||||||
|
$(foreach service,$(SERVICES), systemctl start $(service);)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(foreach config,$(CONFIG), rm -i $(CONFIG_DIR)/$(config);)
|
||||||
|
$(foreach service,$(SERVICES), systemctl stop $(service);)
|
||||||
|
$(foreach service,$(SERVICES), systemctl disable $(service);)
|
||||||
|
$(foreach service,$(SERVICES), rm -i $(SYSTEMD_DIR)/$(service);)
|
23
cgconfig.conf
Normal file
23
cgconfig.conf
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#
|
||||||
|
# Copyright IBM Corporation. 2007
|
||||||
|
#
|
||||||
|
# Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of version 2.1 of the GNU Lesser General Public License
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it would be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
#
|
||||||
|
|
||||||
|
group chromium {
|
||||||
|
cpu {
|
||||||
|
cpu.shares = "1000";
|
||||||
|
}
|
||||||
|
|
||||||
|
memory {
|
||||||
|
memory.limit_in_bytes = "1G";
|
||||||
|
memory.soft_limit_in_bytes = "768M";
|
||||||
|
}
|
||||||
|
}
|
12
cgconfigparser.service
Normal file
12
cgconfigparser.service
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=cgroup config parser
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf
|
||||||
|
Type=oneshot
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
27
cgred.conf
Normal file
27
cgred.conf
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
|
||||||
|
#
|
||||||
|
# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
|
||||||
|
# the only valid ones. Defining anything else in this file will cause the
|
||||||
|
# CGroup Rules Engine program to fail. So, don't do it.
|
||||||
|
|
||||||
|
# The pathname to the configuration file for CGroup Rules Engine
|
||||||
|
CONFIG_FILE="/etc/cgrules.conf"
|
||||||
|
|
||||||
|
# Uncomment the following line to log to specified file instead of syslog
|
||||||
|
#LOG_FILE="/var/log/cgrulesengd.log"
|
||||||
|
|
||||||
|
# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
|
||||||
|
NODAEMON=""
|
||||||
|
#NODAEMON="--nodaemon"
|
||||||
|
|
||||||
|
# Set owner of cgred socket. 'cgexec' tool should have write access there
|
||||||
|
# (either using suid and/or sgid permissions or Linux capabilities).
|
||||||
|
SOCKET_USER=""
|
||||||
|
SOCKET_GROUP="cgred"
|
||||||
|
|
||||||
|
# Uncomment the second line to disable logging for CGroup Rules Engine
|
||||||
|
# Uncomment the third line to enable more verbose logging.
|
||||||
|
LOG=""
|
||||||
|
#LOG="--nolog"
|
||||||
|
#LOG="-v"
|
||||||
|
|
12
cgrules.conf
Normal file
12
cgrules.conf
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# /etc/cgrules.conf
|
||||||
|
#The format of this file is described in cgrules.conf(5)
|
||||||
|
#manual page.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#<user> <controllers> <destination>
|
||||||
|
#@student cpu,memory usergroup/student/
|
||||||
|
#peter cpu test1/
|
||||||
|
#% memory test2/
|
||||||
|
# End of file
|
||||||
|
pgrondek:/usr/bin/google-chrome cpu,memory chromium
|
||||||
|
pgrondek:/home/pgrondek/bin/rambox cpu,memory chromium
|
14
cgrulesgend.service
Normal file
14
cgrulesgend.service
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=cgroup rules generator
|
||||||
|
After=network.target cgconfigparser.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
Type=forking
|
||||||
|
EnvironmentFile=-/etc/cgred.conf
|
||||||
|
ExecStart=/usr/sbin/cgrulesengd
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in a new issue