I had a slightly similar issue with gzip.
Assuming we want to decrease the CPU of a gzip process:
gzip backup.tar & sleep 2 & cpulimit --limit 10 -e gzip -z
Options:
- I found
sleepuseful as thecpulimitsometimes didn’t pick up the newgzipprocess immediately --limit 10limitsgzipCPU usage to 10%-zautomatically closescpulimitwhengzipprocess finishes
Another option is to run the cpulimit daemon.