diff options
Diffstat (limited to 'sh/openrc-run.sh.in')
-rw-r--r-- | sh/openrc-run.sh.in | 15 |
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 |