Enabling a user does not enable it

Forums / NoMachine for Linux / Enabling a user does not enable it

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35219
    jeremy.fix
    Participant

    Hi,

    My use case is that I’m starting NoMachine (v7.6.2) automatically with a script and then enable a user (the server is configured with “EnableUserDB 1”) in a bash script

    systemctl is-active --quiet nxserver
    exit_code="$?"
    if [ "$exit_code" != "0" ]
    then
    # The service is not running, we start it
    service nxserver start
    # sleep 2 # Weird hack to make it work
    fi
    # Authorize the user to open a nomachine session
    log "Nxserver enabling of $SLURM_JOB_USER"
    /usr/NX/bin/nxserver --userenable $SLURM_JOB_USER

    Unfortunately, even though I see NoMachine saying my user is enabled “NX> 301 User ‘xxxx’ is enabled in the NX user DB.”, half of the time it ends being enabled and half of the time it is not. I check the status with ‘/usr/NX/bin/nxserver –userlist’ and also checked if I could log or not with nxplayer.

    My weird hack is to add a “sleep 2” and now it always works but that’s awful;

    I thought I should be waiting for the nxserver to be started but my attempt were unsucessful . I used the code

    service nxserver start
    systemctl is-active --quiet nxserver
    exit_code="$?"
    while [ "$exit_code" != "0" ]; do
    systemctl is-active --quiet nxserver
    exit_code="$?"
    sleep 1
    done

    Do you have any idea on what is going wrong and what’s the proper way to handle it ?

    Thank you for your help and thank you for the good job.

    #35286
    kroy
    Contributor

    In your script possibly instead of:

    service nxserver start

    Use this:

    service nxserver start > /dev/null 2>&1 &

    or

    /etc/NX/nxserver --startup

    #35316
    jeremy.fix
    Participant

    Thank you for your answer but unfortunately I do not understand why that should fix the problem.

    Your first suggestion will just redirect the stdout and stderr to /dev/null

    For the second one you propose, it triggers two questions in my mind ; The nxserver service starts

    /etc/NX/nxserver --daemon

    which is indeed different from the one you propose : etc/NX/nxserver --startup ; But do you know the difference ? is etc/NX/nxserver --startup blocking when etc/NX/nxserver --daemon is not ?

    Thank you.

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

You must be logged in to reply to this topic.