1

In cpulimit

-l, --limit=N

percentage of CPU allowed from 1 up. Usually 1 - 100, but can be higher on multi-core CPUs. (mandatory)

What option argument can I give to -l when I want a process to have no limit on cpu usage?

Is it $(($(nproc)*100))?

(I am writing a script, which accepts a command line argument and assigns it as an option argument to -l. In case the command line argument is not specified to the script, I would like to provide a default value, which represents no limit.)

Thanks.

Tim
  • 98,580
  • 191
  • 570
  • 977

1 Answers1

1

Based on Kamil's comment (don't use cpulimit when not needed), I would just do domething like this in your script:

cmd=<command you want to run>

limit=<your cpu limit. can be empty>

if [ -z "$limit" ]; then
    cpulimit_cmd=""
else
    cpulimit_cmd="cpulimit -l $limit"
fi

$cpulimit_cmd $cmd
WerKater
  • 196
  • 1
  • 4