commands
renice — change existing process niceness
On util-linux, -n sets absolute niceness unless POSIXLY_CORRECT changes interpretation; use clean environment. Increase niceness only on your own child. Do not request increased scheduling preference. Use a fresh private workspace, ordinary user and bounded child processes; no sudo.
Formal Syntax & Structure
linux syntaxlinux
renice -n PRIORITY -p PIDParameters & Attributes
| Name | Type | Description |
|---|---|---|
| -n | option | Takes an absolute nice value on the tested util-linux implementation when POSIXLY_CORRECT is unset; relative when set. |
| -p | option | Interpret following identifiers as PIDs. |
| PID | operand | just-started child |
| PRIORITY | operand | Desired nice value in the shown clean-environment form; increase niceness only for your own lab child. |
Return Value
exit status and output
On util-linux, -n sets absolute niceness unless POSIXLY_CORRECT changes interpretation; use clean environment. Increase niceness only on your own child. Do not request increased scheduling preference.
Working Example
Example Snippetlinux
sleep 2 &child=$!rc=0renice -n 19 -p "$child" > change.txt || rc=$?if [[ $rc -eq 0 ]]; then value=$(ps -p "$child" -o ni=) || rc=$?fiwait "$child" || exit 1test "$rc" -eq 0 || exit 1[[ $value =~ ^[[:space:]]*19[[:space:]]*$ ]] || exit 1printf "nice is 19\n"