[FreeNX-kNX] nxcheckload second
Bastian Kames
kames at ibg-monforts.de
Fri Jul 20 11:38:40 UTC 2007
Hi,
after I change the nxserver --list I`m now able to do so
if [ "$1" != "" ]
then
USER=$(nxserver --list | grep -v Display |grep -v - | grep -v "NX>" |grep $1|
wc -l)
LOAD=$(exec ssh -l root $1 /usr/bin/nxcheckload)
echo "1000 - $USER + (1000 - (100*$LOAD)) " | bc -q
exit 0
fi
export LC_NUMERIC=C
LOAD=$(awk '{ printf("%s",$2 ); }' /proc/loadavg)
echo "$LOAD " | bc -q
Am Freitag, 20. Juli 2007 13:24 schrieben Sie:
> > Hi,
> >
> > How do I use nxcheckload.
>
> nxcheckload will be called for each server that you have in your round
> robin list once with "$1" as the server as parameter.
>
> It is supposed to return a number, which should somehow be associated with
> the "load" of the remote machine.
>
> The server with the lowest load is chosen for the session.
>
> In your case setup could be as easy as:
>
> - Create a script and copy it to all servers like:
>
> #!/bin/sh
> # numusers.sh
>
> nxserver --list | grep -v Display |grep -v - | grep -v "NX>" | wc -l
>
> Then run it for example with netcat in an endless loop:
>
> netcat -l -p xxxy -e ./numusers.sh
>
> - Your nxcheckload script would then look like:
>
> netcat "$1" xxxy
>
> This is the more general way and just an example setup.
>
> With your changes to --list, you can of course do just return in
> nxcheckload:
>
> nxserver --list | egrep ^"$1" | grep -v Display |grep -v - | grep -v "NX>"
> | wc -l
>
> cu
>
> Fabian
More information about the FreeNX-kNX
mailing list