NXClient as desktop manager

Objective
To get NXClient launched solely on a full machine (full blown gentoo install, which in fact is running the nxserver).

Reasons

 * The ability to change from one computer to another just by suspending / resuming is fantastic.
 * If a user who doesn't have access normally to the server but rather only to a thin client and he wants to access some hardware on the server, I don't want him to have to login to KDM (or whatever DM you choose) and then run NXServer, but rather to have him face directly an NX login window
 * If there's a power outage, and a remote user wants to resume his/her session, they can easily use the server

Ways to make it work
Although there have been reported several ways to make it work (and even more which don't work), this is just a short outline of one method. This works completely without xdm as there were several unsolvable problems which have been addressed in many other HowTos on this topic.
 * /etc/init.d/xdm start/stop doesn't really know when it successfully started/stoped the nxdesktop
 * in some cases xdm would start too early on tty2 with a dead keyboard
 * without a display manager xinit would just die as nxclient spawns another process (nxssh) after login and terminates itself. So you need a display manager running to keep X running.

It's basically just one bash script which is run by /etc/init.d/local after everything else started. Programs used:
 * nxserver/nxclient
 * aewm desktop manager

Remark: To logout from an nxdesktop session running in fullscreen mode use the hotkey CTRL+ALT+T

a possible name would be /root/nxdesktop.sh ARG=$1 if [ "$ARG" = "start" ] then echo " starting NXDesktop..." echo $$ > /var/run/nxdesktop.pid #run xinit in a loop to respawn the desktop if killed while [ -f "/var/run/nxdesktop.pid" ]; do               xinit /root/nxdesktop.sh &> /dev/null sleep 1 done rm -f /var/run/nxdesktop.pid else if [ "$ARG" = "stop" ] then rm -f /var/run/nxdesktop.pid #may be a bit rough, but works killall X       else shift echo -e $$ > /var/run/nxdesktop.pid #set flags for nxclient according to               #http://www.nomachine.com/documents/configuration/client-guide.php #to respawn when closed touch /usr/NX/share/noexit #to not allow changes to the configuration touch /usr/NX/share/noconfig #to not save the password touch /usr/NX/share/nopasswd #call nxclient with the preconfigured session file /usr/NX/bin/nxclient --session /root/.nx/config/localhost.nxs & #run aewm as window manager to prevent X from closing when nxclient is terminated #also set all buttons to show the list of windows, which should only be NXclient aewm -1 "aemenu --switch" -2 "aemenu --switch" -3 "aemenu --switch" fi fi
 * 1) !/bin/bash

then add the line /root/nxdesktop.sh start & to /etc/conf.d/local.start and /root/nxdesktop.sh stop to /etc/conf.d/local.stop

then configure your nx session and save it to /root/.nx/config/localhost.nxs and make sure local is in your default runlevel rc-update add local default

Then after a reboot or /etc/init.d/local start you should be presented an X screen with only the nxclient login window