~woffs/loadwatch

Run a program using only idle cycles
6d2544c0 — Frank Doepper 3 years ago
make gcc happy
7d596df6 — Frank Doepper 3 years ago
initial commit of 1.1

clone

read-only
https://git.sr.ht/~woffs/loadwatch
read/write
git@git.sr.ht:~woffs/loadwatch

You can also use your local clone with git send-email.

loadwatch 1.1 README
copyright (C) 1997-2000 lantz moore <lmoore@tump.com>
  with help from Dale E. Martin <dmartin@clifton-labs.com> and 
                 Mark Boyns <boyns@doit.org>

loadwatch allows one or more processes to run only when the load on a
machine is within certain bounds.  the child processes are sent SIGSTOP
when the machines load passes the high load mark.  the processes are sent
SIGCONT only after the machines load drops below the low load mark.  the
load is checked at a user definable interval.  

loadwatch is distributed under the GNU GPL.

usage:
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.

example:
loadwatch -d 10 -h 1.25 -l .25 -- ./rc5des

which means: check the load every 10 seconds, stop rc5des when the load is 
greater than 1.25 and restart rc5des when the load drops to .25.

lw-ctl <filename> <cmd>
	<filename> is the control file, this corresponds to a unix domain
		socket.
	<cmd> is the command to send to the loadwatch process.
                RUN -> put loadwatch into RUN mode, that is the child process
                        runs regardless of the load.
                STOP -> put loadwatch into STOP mode, that is, the child
                        process will not run regardless of the load.
                WATCH -> WATCH mode, the normal load watching mode.

example:
lw-ctl ./fooey RUN

causes the loadwatch process (if it was started with "-u ./fooey") to go
into RUN mode.  you could put lw-ctl in a cron job that runs in the
morning to put the job in STOP mode and then again in the evening to put
the job back into WATCH mode.

the children which loadwatch forks are all part of the same process group.
loadwatch stops and starts the processes by signalling the process
group with SIGSTOP and SIGCONT respectively.

send suggestions and bug reports to <lmoore@tump.com>.  if you do anything
interesting with loadwatch, let me know.  i use it for controlling the
distributed.net clients, but i figure it'd be good to control thinks like
crack as well.

you can get loadwatch from ftp://rplay.doit.org/pub/loadwatch/

loadwatch comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
This is free software, and you are welcome to redistribute it
under certain conditions; see COPYING for details.

oh, and yes, i do realize how goofy it is to release this as a package. :)