[RC5] Re: loadwatch and dnetc

Ville Nummela vige at hameenlinna.cx
Sat Nov 27 10:31:59 EST 1999


This thread started immediatelly going to totally different directions than
what I intended it to do..
But anyway. Since I know that there are other people who'd like to have some
external application to stop dnetc when needed, I decided to send my script
here:

#!/bin/sh
CLIENT=$3
LIMIT=$1
LOLIM=$2
./$CLIENT &
while /bin/true
do
LOAD=`uptime | cut -d ' ' -f 15 | colrm 5 99 | colrm 2 2`
if test $LOAD -ge $LIMIT
then
echo $LOAD bigger than $LIMIT
killall -TSTP $CLIENT
fi
if test $LOAD -lt $LOLIM
then
echo $LOAD less than $LOLIM
killall -CONT $CLIENT
fi
sleep 30
done

Using killall is quite rude, but it works. The usage is: loadwatch.sh
highlimit lowlimit client, where the limits are with three numbers so that 100
is load 1.00 and 200 is 2.00 and so on. e.g. ./loadwatch.sh 200 100 dnetc.
The sleep value probably needs to be adjusted by most people.


--
 |   vnummela at lut.fi work: +358-5-4125389 home: +358-40-5075560     |
 |     IRC naturae alienum est! Periculosum est! Delendum est!      |


--
To unsubscribe, send 'unsubscribe rc5' to majordomo at lists.distributed.net
rc5-digest subscribers replace rc5 with rc5-digest



More information about the rc5 mailing list