From 0cfbc91382279794682fbe6dac45fd05d2f29d5a Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 11 Aug 2010 22:00:57 +0000 Subject: [PATCH] Allow creation and attaching to cgroups even when it's automatic. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2910 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- scripts/vserver.functions | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/vserver.functions b/scripts/vserver.functions index dc6427e..228c70b 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -1496,9 +1496,8 @@ function _handleCgroup useCgroup "$vdir" || return 0 findDir dir "$vdir/cgroup" "$__CONFDIR/.defaults/cgroup" "" - test -d "$dir" || return 0 - if test -r "$dir"/name; then + if test -n "$dir" -a -r "$dir"/name; then read name < "$dir"/name else name="$VSERVER_NAME" @@ -1513,13 +1512,15 @@ function _handleCgroup cat "$parent/$i" > "$CGROUP_MNT/$name/$i" done - shopt -s nullglob - for i in "$dir"/*; do - f="${i##*/}" - test "$f" != mnt -a "$f" != subsys -a \ - "$f" != inherit -a "$f" != name || continue - cat "$i" > "$CGROUP_MNT/$name/$f" - done + if test -n "$dir"; then + shopt -s nullglob + for i in "$dir"/*; do + f="${i##*/}" + test "$f" != mnt -a "$f" != subsys -a \ + "$f" != inherit -a "$f" != name || continue + cat "$i" > "$CGROUP_MNT/$name/$f" + done + fi fi echo "$$" > "$CGROUP_MNT/$name/tasks" elif test "$action" = "destroy"; then -- 1.8.1.5