aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorAlexander V Vershilov <qnikst@gentoo.org>2014-02-16 04:27:52 +0400
committerWilliam Hubbs <w.d.hubbs@gmail.com>2014-07-10 10:56:37 -0500
commit1a44be0f16a7a1de8a176e7c656f8513494e0e64 (patch)
tree8509337b2fd6475c22c0d9b7ccf8ddd2ad3e0fbf /sh
parentf265ddde971d0fdb97a4f14b4cc96140be7b4628 (diff)
cgroups: only run cgroup setup when starting a service
Status call should not set limits as it requires root permissions, also this is not safe, as current process may reach limitation. Solution is to set limits and move process to service cgroup only on start. X-GENTOO-BUG: 500364 X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364
Diffstat (limited to 'sh')
-rw-r--r--sh/runscript.sh.in2
1 files changed, 2 insertions, 0 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index ceb9ab45..c72a784c 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -215,12 +215,14 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then
fi
# Apply cgroups settings if defined
+if [ "$1" = "start" ] ; then
if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
cgroup_add_service /sys/fs/cgroup/openrc
cgroup_add_service /sys/fs/cgroup/systemd/system
fi
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
cgroup_set_limits
+fi
# Load our script
sourcex "$RC_SERVICE"