From 65600eead296f8d5f1c04f2cecb565baec7ac169 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 8 Aug 2011 09:23:28 +0200 Subject: [PATCH] Only give ionice the arguments provided --- scripts/vserver.functions | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/vserver.functions b/scripts/vserver.functions index d10ccf2..ee1751e 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -154,15 +154,21 @@ function _generateNiceCommand function _generateIONiceCommand { local vdir=$1 - local ionice_class=2 - local ionice_priority=0 + local ionice_class= + local ionice_priority= test -n "$_IONICE" || return 0 test -r "$vdir/ionice/class" && read ionice_class <"$vdir"/ionice/class test -r "$vdir/ionice/priority" && read ionice_priority <"$vdir"/ionice/priority - IONICE_CMD=( $_IONICE -c$ionice_class -n$ionice_priority ) + test -n "$ionice_class$ionice_priority" || return 0 + + if test -z "$ionice_class" -a -n "$ionice_priority"; then + IONICE_CMD=( $_IONICE -c2 -n"$ionice_priority" ) + else + IONICE_CMD=( $_IONICE ${ionice_class:+-c$ionice_class} ${ionice_priority:+-n$ionice_priority} ) + fi } function _generatePersonalityOptions -- 1.8.1.5