<br><font size=2 face="sans-serif">I doubt anyone is intersted anymore,
but just in case</font>
<br><font size=2 face="sans-serif">here's a re-patch to allow shadowing
of console sessions.</font>
<br>
<br><font size=2 face="sans-serif">Note this applies to ubuntu FreeNX and
its derivatives.</font>
<br>
<br><font size=2 face="sans-serif">Fedora, Centos & Suse haven't included
the patch mentioned.</font>
<br>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">A previous patch, which stopped "nxclient"
using lots of server</font>
<br><font size=2 face="sans-serif">resource by repeatedly calling</font>
<br>
<br><font size=2 face="sans-serif"> session_list_user_suspended()</font>
<br>
<br><font size=2 face="sans-serif">in nxserver every few second , (to update
the client's list of user sessions in case they'd changed ),</font>
<br><font size=2 face="sans-serif">renamed the procedure and wrapped it
as :-</font>
<br>
<br><font size=2 face="sans-serif">SESSION_LIST_CACHE_DATA=$(_session_list_user_suspended
"$@")</font>
<br>
<br><font size=2 face="sans-serif">(line 276)</font>
<br>
<br><font size=2 face="sans-serif">Calling the wrapped procedure by spawning,
stopped the variable</font>
<br>
<br><font size=2 face="sans-serif"> DESKTOP_SHARING_IDS</font>
<br>
<br><font size=2 face="sans-serif">in</font>
<br><font size=2 face="sans-serif">the calling instance of nxsever</font>
<br><font size=2 face="sans-serif">from</font>
<br><font size=2 face="sans-serif">including the NEW uniqueid(s) created
for the "(Local)" ( :0) session(s),</font>
<br>
<br><font size=2 face="sans-serif">uniqueid=$(echo $[$RANDOM*$RANDOM] |
$COMMAND_MD5SUM | cut -d" " -f1 | tr "[a-z]" "[A-Z]")</font>
<br><font size=2 face="sans-serif">(line 366)</font>
<br>
<br><font size=2 face="sans-serif">which</font>
<br><font size=2 face="sans-serif">not being FreeNX sessions, don't appear
in</font>
<br>
<br><font size=2 face="sans-serif"> /var/lib/nxserver/db/running/*</font>
<br>
<br><font size=2 face="sans-serif">This meant that the code for launching
nxagent in shadow mode</font>
<br><font size=2 face="sans-serif">couldn't find the "shadowdisplay"</font>
<br>
<br><font size=2 face="sans-serif">shadowdisplay=$(echo $DESKTOP_SHARING_IDS
| tr ' ' '\n' | egrep "^$uniqueid=" | cut -d'=' -f2)</font>
<br><font size=2 face="sans-serif">(line 1335)</font>
<br>
<br><font size=2 face="sans-serif">hence</font>
<br>
<br><font size=2 face="sans-serif"> NX>
596 Could not find shadowed session . . . . . Session failed.</font>
<br>
<br><font size=2 face="sans-serif">in the log.</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">--- nxserver-ubuntu 2012-01-01
00:00:00.000000000 +0100</font>
<br><font size=2 face="sans-serif">+++ nxserver 2012-07-04
12:33:38.000000000 +0100</font>
<br><font size=2 face="sans-serif">@@ -266,20 +266,18 @@</font>
<br>
<br><font size=2 face="sans-serif"> # List all sessions of a user</font>
<br>
<br><font size=2 face="sans-serif">+</font>
<br><font size=2 face="sans-serif">+session_list_user_suspended()</font>
<br><font size=2 face="sans-serif">+{</font>
<br><font size=2 face="sans-serif"> # Cache the session list output
for up to 30 seconds because nxclient</font>
<br><font size=2 face="sans-serif"> # repeatedly queries it very fast,
which creates performance problems.</font>
<br><font size=2 face="sans-serif">-session_list_user_suspended() {</font>
<br><font size=2 face="sans-serif">- args="$1
$2 $3 $4"</font>
<br><font size=2 face="sans-serif">- if [[ "$args"
!= "$SESSION_LIST_CACHE_ARGS" || $(($(date +%s) - ${SESSION_LIST_CACHE_TIME:-0}))
-gt 30 ]] ; then</font>
<br><font size=2 face="sans-serif">- SESSION_LIST_CACHE_ARGS="$args"</font>
<br><font size=2 face="sans-serif">- SESSION_LIST_CACHE_TIME=$(date
+%s)</font>
<br><font size=2 face="sans-serif">- SESSION_LIST_CACHE_DATA=$(_session_list_user_suspended
"$@")</font>
<br><font size=2 face="sans-serif">- fi</font>
<br><font size=2 face="sans-serif">- echo "$SESSION_LIST_CACHE_DATA"</font>
<br><font size=2 face="sans-serif">-}</font>
<br>
<br><font size=2 face="sans-serif">-_session_list_user_suspended()</font>
<br><font size=2 face="sans-serif">-{</font>
<br><font size=2 face="sans-serif">+if [[ "$@" == "$SESSION_LIST_CACHE_ARGS"
&& $(($(date +%s) - ${SESSION_LIST_CACHE_TIME:-0})) -lt 30 ]] ;
then</font>
<br><font size=2 face="sans-serif">+ echo "$SESSION_LIST_CACHE_DATA"
# Just repeat what was sent last time . . .</font>
<br><font size=2 face="sans-serif">+else</font>
<br><font size=2 face="sans-serif">+ SESSION_LIST_CACHE_ARGS="$@"</font>
<br><font size=2 face="sans-serif">+ SESSION_LIST_CACHE_TIME=$(date
+%s)</font>
<br><font size=2 face="sans-serif">+</font>
<br><font size=2 face="sans-serif"> SESSION_COUNT=0</font>
<br><font size=2 face="sans-serif"> SESSION_COUNT_USER=0</font>
<br>
<br><font size=2 face="sans-serif">@@ -379,8 +377,10 @@</font>
<br><font size=2 face="sans-serif">
echo "NX> 148 Server capacity: not reached for user:
$1" >> $TMPFILE</font>
<br><font size=2 face="sans-serif"> fi</font>
<br>
<br><font size=2 face="sans-serif">+ SESSION_LIST_CACHE_DATA="$(cat
$TMPFILE)"</font>
<br><font size=2 face="sans-serif"> cat $TMPFILE
| log_tee</font>
<br><font size=2 face="sans-serif"> rm -f $TMPFILE</font>
<br><font size=2 face="sans-serif">+fi</font>
<br><font size=2 face="sans-serif"> }</font>
<br>
<br><font size=2 face="sans-serif"> session_list_user()</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>