in reply to Limiting CPU usage on this program...
The nicier a script, the less greedy it's going to be on system resources. And if it sleeps every once in a while on top of this, it's even more nicier ;)# Set low priority (nice value) for this process... setpriority( "PRIO_PROCESS", 0, 10 ); while(1) { # some code # some more code ... sleep(300); # it's good to take a nap in the middle of a hard work! }
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}
|
|---|