Jim Meyering wrote: > Simon Josefsson <[EMAIL PROTECTED]> wrote: > ... > > Still, maybe not all programs have similar rate-limiting features, so > > that this nice-extension may be useful anyway... > > I agree. Maybe even as a separate program, for when you start something > important and somehow resource-intensive, so that you can regulate its > impact after the fact (via some new tool with a --pid=PID option).
Using the loadwatch program the following works. perl -e '$t=1; while (1) { $t = sqrt $t }' & # run a cpu bound job [1] 18365 loadwatch -d 10 -l 0.4 -h 0.5 -p 18365 # watch it, stop it, run it Fri Mar 31 08:48:30 2006: load too high, stopping. Fri Mar 31 08:49:00 2006: load low, continuing. Fri Mar 31 08:49:20 2006: load too high, stopping. Fri Mar 31 08:50:20 2006: load low, continuing. loadwatch [-d <time>] [-h <load>] [-l <load>] [-n <copies>] [-p <pid>] [-- <command>] -d <int> load sampling interval (10 seconds) -h <float> high load mark (1.25) -l <float> low load mark (0.25) -n <copies> number of children to fork (1) -u <filename> file that will be used to externally control a loadwatch process. -p <pid> pid of process to control (loadwatch will actually send signals to the group containing this pid) NOTE: -p and <command> are mutually exclusive, but one has to be specified. Bob P.S. And of course I am aware of $! for getting the pid. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils