- Fix obsolete nice usage.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Tue, 12 Sep 2006 11:09:15 +0000 (11:09 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Tue, 12 Sep 2006 11:09:15 +0000 (11:09 +0000)
- Make sure the correct nice value is used, even if the parent
  process has a different one.

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2295 94cd875c-1c1d-0410-91d2-eb244daf1a30

scripts/legacy/vserver
scripts/vserver.functions

index fe93fef..e944617 100755 (executable)
@@ -514,7 +514,7 @@ elif [ "$2" = "start" ] ; then
                        DOMAINOPT="--domainname $S_DOMAINNAME"
                fi
                if [ "$S_NICE" != "" ] ; then
-                       NICECMD="nice -$S_NICE"
+                       NICECMD="nice -n $S_NICE"
                fi
                mkdir -p $__PKGSTATEDIR
                chmod 700 $__PKGSTATEDIR
index 7a9b6a8..0f812d4 100644 (file)
@@ -98,12 +98,13 @@ function _generateChbindOptions
 function _generateNiceCommand
 {
     local vdir=$1
-    local nice
+    local nice=0
+    local current_nice=`$_NICE`
 
-    test -r "$vdir/nice" || return 0;
-    read nice <"$vdir"/nice
+    test -r "$vdir/nice" && read nice <"$vdir"/nice
 
-    NICE_CMD=( $_NICE -$nice )
+    let nice=$nice-$current_nice || :
+    NICE_CMD=( $_NICE -n $nice )
 }