Prevent a process from using too much CPU even if available
1
vote
2
answers
5524
views
I would like to avoid a process using too much CPU. In fact, I want to prevent my CPU from heating up since I have some really long CPU demanding tasks (video converting) to run from a Raspberry Pi with Debian on it: temperature rises over 80 °C.
I have seen that there's a
cpulimit
command, but I don't know how to run my command with it since it seems to take either the pid (process ID) as argument or an executable file with the code to run, not the bash command itself. I would like to directly see what my task returns and be able to Ctrl-C if needed. Note: if I try to put my task command into a file and run cpulimit -l 20 --path=/path/to/my/file.sh
, then it returns Warning: no target process found. Waiting for it...
So it looks like I am unable to understand 1) what the --path argument actually does, and 2) how to properly use cpulimit on any terminal command...
I would **prefer** **not to use** workarounds like nohup my-command --my-args &
, even if it secondarily returns the pid and let me write the cpulimit command for it.
Thanks in advance!
Asked by Johannes Lemonde
(155 rep)
Feb 27, 2018, 08:18 PM
Last activity: Aug 3, 2022, 10:59 AM
Last activity: Aug 3, 2022, 10:59 AM