Quote Originally Posted by abcuser View Post
Hi,
OK, now I understand. The idea would probably go in this way. At boot time you start some script to start you program and after that some kind of cpulimit daemon has to start and try to catch PID of your desired program and lower the CPU of that program.

I have written this script some time ago, so it should be something like this (instead of cpulimit daemon write this script)
#!/bin/bash
cpulimit -p $( ps -eo pid,args | grep "process name you would like to CPU limit" | grep -v grep | gawk '{print $1}' ) -l 5 -z &

Note: instead of string "process name you would like to CPU limit" write your process name getting from "ps -eo pid, args" command. Above script assumes you would like to lower CPU to 5% (string: "-l 5" at the end of command), if you would like any other limit change this settings.

After that you have to make sure that your program has to start first and then this new cpulimit script goes second. Assuming you scrip has 20 priority which is by default, run the following script:
update-rc.d cpulimit-daemon defaults 21 19

Note: cpulimit-daemon is your script file name (select appropriate name) to start cpulimit daemon.

Hope this helps,
Regards
That helps a lot, thank you. There is an issue with your ps/grep combo...

Here's the output from the ps and grep:

Code:
 6365 sh -c ./FahCore_a0.exe -dir work/ -suffix 01 -checkpoint 15 -verbose -lifeline 6361 -version 602
 6366 ./FahCore_a0.exe -dir work/ -suffix 01 -checkpoint 15 -verbose -lifeline 6361 -version 602
 6367 ./FahCore_a0.exe -dir work/ -suffix 01 -checkpoint 15 -verbose -lifeline 6361 -version 602
 6368 ./FahCore_a0.exe -dir work/ -suffix 01 -checkpoint 15 -verbose -lifeline 6361 -version 602
 6369 ./FahCore_a0.exe -dir work/ -suffix 01 -checkpoint 15 -verbose -lifeline 6361 -version 602
12331 grep FahCore_a0.exe
and the resulting list of ALL of the PIDs gets sent to cpulimit, however, it only acts on the first. The first PID isn't the one that needs limiting. 6368 is, or rather, 6366, 6367, or 6369 would also work. 6365 is the spawning process, however that just hangs out to check for WU updates and the like, it doesn't handle any computations itself.

Any ideas?

Thanks.