aboutsummaryrefslogtreecommitdiff
path: root/sh/openrc-run.sh.in
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-09-14 10:38:10 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-09-14 10:38:10 -0500
commit457f928e793cb1f6ef254935ad07f58b8762c72f (patch)
treed966829a69958c44f3e153ab5f1392e315c59e15 /sh/openrc-run.sh.in
parenta71a461e452a98554346c47411e9c9012023c201 (diff)
add support for control groups version 2
This is for #94.
Diffstat (limited to 'sh/openrc-run.sh.in')
-rw-r--r--sh/openrc-run.sh.in15
1 files changed, 10 insertions, 5 deletions
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index a38d46d6..e778bd09 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -258,8 +258,7 @@ for _cmd; do
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && \
ulimit ${rc_ulimit:-$RC_ULIMIT}
# Apply cgroups settings if defined
- if [ "$(command -v cgroup_add_service)" = \
- "cgroup_add_service" ]
+ if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]
then
if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
eerror "No permission to apply cgroup settings"
@@ -268,9 +267,11 @@ for _cmd; do
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
+ [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] &&
+ cgroup_set_limits
+ [ "$(command -v cgroup2_set_limits)" = "cgroup2_set_limits" ] &&
+ [ "$_cmd" = start ] &&
+ cgroup2_set_limits
break
fi
done
@@ -368,6 +369,10 @@ while [ -n "$1" ]; do
"$1" = "stop" ] && \
yesno "${rc_cgroup_cleanup}" && \
cgroup_cleanup
+ if [ "$(command -v cgroup2_remove)" = "cgroup2_remove" ]; then
+ [ "$1" = stop ] || [ -z "${command}" ] &&
+ cgroup2_remove
+ fi
shift
continue 2
else