I have a backup script that runs daily and I'd like to limit it's resource usage. The cpulimit program appears to do what I want. I'd like it to only run with this backup script though. I tried putting the command inside the script... #!/bin/sh cpulimit -P /path/this-script.sh -l 20 ... rest of script But it just kills the script this way. The script is run on a cron job. Anyone have suggestions on how to make this work? One way may be to run cpulimit as a daemon but I'd prefer to run it only along with this script and not all the time.
Seems to be working by limiting the shell instead of the script. #!/bin/sh cpulimit -P /bin/sh -l 20 ... rest of script EDIT: Guess not, still hangs up.
Not real clear to me. So if I run with a lower number or higher number it would lower it's priority? Assuming it is running with 0 now nice -n 10 script.sh would increase or decrease its processor usage? Thanks.
I tried nice set to 15 and it's not slowing down the script. When I check the process list the NI value is 15 while all others are 0. But the CPU usage is still higher than I want.