[FreeNX-kNX] nxwho

Bastian Kames kames at ibg-monforts.de
Mon Nov 26 07:03:55 UTC 2007


Hi,

here is a scipt for people using NX as a loadbalancer. The Script show you on which machine a user is connected.
Try it and please give me a feedback.
I wrote to Fabian with no response, but I hobe he think these script is okay. 


Just copy it to /usr/bin/nxwho

Regards,

Bastian



#!/bin/sh
#
# nxwho - script for finding out who is online
#
# Version 0.1
#
# Under GPL
#
# Bastian Kames <bastian at kames.name>
#
# Fabian Franz <FreeNX at fabian-franz.de> ( orginal code)
#


getparam()
{
echo "$CMDLINE" |  tr "&" "\n" | egrep "^"$1"=" | awk -F= '{ VAL=$2 } END { print VAL }'
return 0
}

session_get_cmdline()
{
 echo  | cat - $1 | tr '\n' '&'
}



        echo "NX> 127 Sessions list:"
        echo
        echo "Server          Display         Username                Online "
        echo "----------      -------         ---------------         ----------------"
        for i in /var/lib/nxserver/db/running/*
        do
                CMDLINE=$(session_get_cmdline $i)
echo -e "$(getparam host)\t\t$(getparam display)\t\t$(getparam userName)\t\t$(ls --time-style="+%F %X" -l $i | awk '/sessionId/ { print $6 " " $7 }') "
        done



More information about the FreeNX-kNX mailing list