]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgred:cgred should start when cgroup is mounted
authorWeng Meiling <wengmeiling.weng@huawei.com>
Tue, 10 Sep 2013 06:06:20 +0000 (08:06 +0200)
committerWeng Meiling <wengmeiling.weng@huawei.com>
Tue, 10 Sep 2013 06:06:20 +0000 (08:06 +0200)
If we mount the cgroup without the name cgroup like the following:
cpu on /cgroup/cpu type cgroup (rw,cpu)

the cgred service will start failed, because it just check the name.
So changing cgred to check the mounted system's type instead of the name.

v1 -> v2
Using the right method to check cgroup filesystem. The first version
patch's method is wrong, so resend the second patch.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
scripts/init.d/cgred.in

index ed757cfacac2d95578fd5d8c740d45dca10e4239..247ec610c0c0e4ab1ac163be03253fcac3cb8803 100644 (file)
@@ -73,7 +73,8 @@ start()
                log_failure_msg "$servicename is already running with PID `cat ${pidfile}`"
                return 0
        fi
-       if ! grep "^cgroup" /proc/mounts &>/dev/null; then
+       num=`grep "cgroup" /proc/mounts | awk '$3=="cgroup"' | wc -l`
+       if [ $num -eq 0 ]; then
                echo
                log_failure_msg $"Cannot find cgroups, is cgconfig service running?"
                return 1