Launch session using command line in with NoMachine 5 TS?

Forum / NoMachine Terminal Server Products / Launch session using command line in with NoMachine 5 TS?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15164
    strawpail
    Participant

    Hi there,

    I have a working NoMachine 5 Terminal Server (demo license) running on a remote headless Centos 6 server and can happily connect and launch virtual desktop sessions using the graphical NoMachine client on my linux workstation. I can even have nxplayer launch the session on the server without any prompts using a customized nxs file.

    However I have a requirement that users be able to start a NoMachine session without using their workstation’s NoMachine client and without having any other existing X session. In this scenario, access to TS hosts is controlled dynamically in a way not accessible or visible to NoMachine. Among other things this control provides for a session time limit for user sessions (the NX “idle timeout” option doesn’t do this).

    The nxplayer command itself does not seem to allow for this – it seems to require that it be run from a session which has some graphical capability and doesn’t seem to allow me to instantiate a detached session unless I already have a gui from which to run it, always reporting “nxplayer.bin: cannot connect to X server”. For similar chicken-and-egg reasons, the UserScriptBeforeLogin and UserScriptBeforeSessionStart options in server.cfg are also don’t meet this need.

    The best I have come up with so far is to provide nxplayer on the TS host with a session file and a local (server-side) X server via xvfb, as in:

    xvfb-run nxplayer –session session_start.nxs –exit

    However this does not provide any feedback to users if there is an error of any sort.

    I have also had a look through the forums and not found anything that quite answers my question, but am very happy to be corrected if I have missed something.

    Is there a sensible way to start a NoMachine session from a linux commandline without using a GUI at all? Is there a command which users or the system could run from a commandline without an X server (eg scripts, ssh -x or cron), which would launch a detached NoMachine session for them to connect to at a later time using the NoMachine client on their workstations?

    Is there a better, more supportable way to launch a NoMachine session without an X server for the launcher?

    I’d appreciate any advice!

    #15181
    brotech
    Participant

    Hello,
    please try to use those 2 commands one by one (replace username by targeted user, and run both commands as that user):

    Xvfb :99 -auth /home/username/.Xauthority -screen 0 1024x768x24
    DISPLAY=:99 /etc/NX/nxserver –startsession

    The first one will run Xvfb server, and second start session on already created display.
    Command xvfb-run could help also but it terminates Xvfb when application finishes.

    The command nxserver –startsession will start the session and leave the session running in the background. This command will also report whether the session was started or failed.

    You could also copy xvfb-run to own script for example ‘startvirtualsession’, and modify by removing clean_up function. It could vary on version of Xvfb.

    #15205
    strawpail
    Participant

    Hi brotech,

    Thanks, this is almost exactly what I am looking for and is tidier than the approach I was using.

    Is there a way to have the nxserver launch a console or xterm instead of a full desktop?

    From your response I was able to find AR04D00380 which describes exactly what I want (/usr/NX/bin/nxserver –startsession –type=unix-application –application=xterm –rootless=1) for NX3.5.0. However doesn’t work for NX5 (no errors – it just starts a full desktop every time) and I have not been able to find an article for the current version. The nxserver help suggests that –startsession will accept OPTIONS but I can see anything that details the options I’m looking for.

    Thanks again!

    #15217
    mlyn
    Contributor

    Hello,

    to run console or xterm please set path to application in key DefaultDesktopCommand in node.cfg.

    you can also create <username>.node.cfg in the same directory with different value assigned to specified user.

    Please also change ConnectPolicy key in server.cfg to have: “automigrate=0”.

Viewing 4 posts - 1 through 4 (of 4 total)

This topic was marked as solved, you can't post.