OpenWrt Forum Archive

Topic: "nice" shell command, anyone?

The content of this topic has been archived on 29 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Is the shell "nice" command (to start processes with scheduling priority different from the default) available in any package? If not, it would be, er, nice to add it to the distribution: Broadcom CPU's are not speed demons and sometimes it's important to prevent background tasks from affecting realtime applications (Asterisk, in my case).

Enzo

enzo wrote:

Is the shell "nice" command (to start processes with scheduling priority different from the default) available in any package? If not, it would be, er, nice to add it to the distribution[...]

Or, in alternative, might the maintainers consider to enable it in Busybox at the next rebuild? I see at http://www.busybox.net/downloads/BusyBox.html#item_nice that it's available for inclusion at compile time.

Enzo

Hello enzo.

You can add the nice utility at the compilation time by modifying the default busybox configuration :

OpenWrt Package Selection > Busybox configuration > Processess Utilities > renice

Or you can simply edit the file : package/busybox/config/procps/Config.in, locate these lines :

config BUSYBOX_CONFIG_RENICE
        bool "renice"
        default n
        help
          Renice alters the scheduling priority of one or more running
          processes.

and replace "default n", by "default y"

RItalMan wrote:

Hello enzo.

You can add the nice utility at the compilation time by modifying the default busybox configuration :

OpenWrt Package Selection > Busybox configuration > Processess Utilities > renice

Or you can simply edit the file : package/busybox/config/procps/Config.in, locate these lines :

config BUSYBOX_CONFIG_RENICE
        bool "renice"
        default n
        help
          Renice alters the scheduling priority of one or more running
          processes.

and replace "default n", by "default y"

Thanks. But I recommend to make it part of the standard distribution, as I think it's an important component...

Enzo

P.S. Doesn't that include "renice" rather than "nice"? Well, anyway that would be sufficient, because this script can implement the latter through the former:

#!/bin/sh
local ADJUST=10
case "_$1" in
_)
        renice 0 0 | sed -e 's/.*priority \([0-9]\+\),.*/\1/'
        exit
;;
_-n)
        ADJUST=$2
        shift;shift
;;
_--adjustment=*)
        ADJUST=${1#--adjustment=}
        shift
;;
_-*)
        ADJUST=${1#-}
        shift
;;
esac

if expr "$ADJUST" : '[+-]\?[0-9]\+$' >/dev/null ; then
        exec sh -c "renice $ADJUST \$$ >/dev/null ; exec $* "
else
        echo >&2 "$(basename $0): invalid option '$ADJUST'"
        exit 1
fi

(Last edited by enzo on 13 Nov 2005, 14:55)

The discussion might have continued from here.