]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Exit early if cpusets not enabled in sysconfig/system.
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 7 Dec 2006 21:18:08 +0000 (21:18 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 7 Dec 2006 21:18:08 +0000 (21:18 +0000)
svn-id: @8076

rc.d/init.d/cpusets

index b71f61d364d5ce24fb0b674a03b58c49dda8b7fb..099d79d0c912e2a88d18032c02de5ccc0035c5e8 100644 (file)
 
 # $Id$
 
+. /etc/sysconfig/system
+
+if [ "${CPUSETS:-no}" = "no" ]; then
+       case "$1" in
+       start|stop|restart)
+               exit 0
+               ;;
+       esac
+fi
+
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-if is_yes "${CPUSETS}" ; then
-       if ! grep -q "/dev/cpuset" /proc/mounts ; then
-               nls "ERROR: CPUSET support not enabled in kernel or /dev/cpuset not mounted" >&2
-       fi
-else
+if is_yes "${CPUSETS}" && ! grep -q "/dev/cpuset" /proc/mounts ; then
+       nls "ERROR: CPUSET support not enabled in kernel or /dev/cpuset not mounted" >&2
        exit 0
 fi
 
@@ -68,7 +75,7 @@ cpuset_empty()
 start() {
        rc_splash "bootcpusets start"
 
-       for i in $cpusets_boot ; do
+       for i in $cpusets_boot; do
                show "$(nls -n "Creating cpuset %s" "$i")"
                if cpuset_create $i ; then
                        ok
@@ -81,11 +88,11 @@ start() {
 }
 
 stop() {
-       for i in $cpusets_boot ; do
+       for i in $cpusets_boot; do
                show "$(nls -n "Removing cpuset %s" "$i")"
                busy
-               if cpuset_empty $i ; then
-                       if cpuset_remove $i ; then
+               if cpuset_empty $i; then
+                       if cpuset_remove $i; then
                                ok
                        else
                                fail
@@ -136,15 +143,15 @@ case "$1" in
        echo "$cpusets_boot"
        echo
        nls "Currently empty cpusets:"
-       for i in `ls -1 /dev/cpuset` ; do
-               if [ -d /dev/cpuset/$i ] ; then
+       for i in `ls /dev/cpuset 2>/dev/null`; do
+               if [ -d /dev/cpuset/$i ]; then
                        cpuset_empty $i && echo $i
                fi
        done
        echo
        nls "Currently active cpusets:"
-       for i in `ls -1 /dev/cpuset` ; do
-               if [ -d /dev/cpuset/$i ] ; then
+       for i in `ls /dev/cpuset 2>/dev/null`; do
+               if [ -d /dev/cpuset/$i ]; then
                        cpuset_empty $i || echo $i
                fi
        done
This page took 0.125736 seconds and 4 git commands to generate.