summaryrefslogtreecommitdiff
path: root/sh/runscript.sh.in
diff options
context:
space:
mode:
authorAlexander Vershilov <qnikst@gentoo.org>2013-02-03 16:01:16 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-02-16 01:28:35 -0600
commitb46747f9981337470353014bfa34e9f9f8bace34 (patch)
tree35143d1903a83ec63f20a3f2aac6a91cc46a94c4 /sh/runscript.sh.in
parent86dbd757e94fe5402efea03f9f8725a71533297a (diff)
downloadopenrc-b46747f9981337470353014bfa34e9f9f8bace34.tar.gz
openrc-b46747f9981337470353014bfa34e9f9f8bace34.tar.bz2
openrc-b46747f9981337470353014bfa34e9f9f8bace34.tar.xz
Add module for cgroup processing
sh/rc-cgroup.sh.in: new script to handle cgroup processing sh/rc-cgroup.sh.in: do not use grep or cut (modification by William Hubbs) sh/runscript.sh.in: use the cgroup script
Diffstat (limited to 'sh/runscript.sh.in')
-rw-r--r--sh/runscript.sh.in26
1 files changed, 5 insertions, 21 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index f953afb..c9a3745 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -34,6 +34,7 @@ sourcex()
sourcex "@LIBEXECDIR@/sh/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
+[ "$RC_SYS" != "PREFIX" ] && sourcex -e "@LIBEXECDIR@/sh/rc-cgroup.sh"
# Support LiveCD foo
if sourcex -e "/sbin/livecd-functions.sh"; then
@@ -204,30 +205,13 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
-if [ "$RC_UNAME" = "Linux" -a "$RC_SYS" != "PREFIX" -a "$1" = "start" ]; then
- openrc_cgroup=/sys/fs/cgroup/openrc
- if [ -d ${openrc_cgroup} ]; then
- cgroup=${openrc_cgroup}/${RC_SVCNAME}
- mkdir -p ${cgroup}
- [ -f "${cgroup}"/tasks ] && echo 0 > "${cgroup}"/tasks
- fi
-
- shares="${rc_cgroup_cpu_shares:-$RC_CGROUP_CPU_SHARES}"
- if [ -n "${shares}" -a -d /sys/fs/cgroup/cpu ]; then
- cgroup=/sys/fs/cgroup/cpu/openrc_${RC_SVCNAME}
- if [ ! -d ${cgroup} ]; then
- mkdir -p ${cgroup}
- fi
- [ -f "${cgroup}"/cpu.shares ] && echo ${shares} > "${cgroup}"/cpu.shares
- [ -f "${cgroup}"/tasks ] && echo 0 >> "${cgroup}"/tasks
- fi
-
- #todo: add processes to cgroups based on settings in conf.d
-fi
-
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
+# Apply cgroups settings if defined
+[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
+ cgroup_set_limits
+
# Load our script
sourcex "$RC_SERVICE"