Forum / NoMachine for Linux / Enabling a user does not enable it
- This topic has 4 replies, 3 voices, and was last updated 3 years, 1 month ago by jeremy.fix.
-
AuthorPosts
-
September 9, 2021 at 21:42 #35219jeremy.fixParticipant
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.
September 15, 2021 at 13:18 #35286kroyContributorIn your script possibly instead of:
service nxserver start
Use this:
service nxserver start > /dev/null 2>&1 &
or
/etc/NX/nxserver --startup
September 16, 2021 at 18:11 #35316jeremy.fixParticipantThank 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 ? isetc/NX/nxserver --startup
blocking whenetc/NX/nxserver --daemon
is not ?Thank you.
October 5, 2021 at 12:46 #35581brotechParticipantHello,
the main difference is that
/etc/NX/nxserver --startup
run daemon and then is waiting for it to be ready.So using
/etc/NX/nxserver --startup
instead of other commands
you will be sure that sleep is not needed anymore.October 5, 2021 at 16:20 #35586jeremy.fixParticipantThank you for the feedback ; This is indeed the one that I used in production
/etc/NX/nxserver --startup
# Authorize the user to open a nomachine session
/usr/NX/bin/nxserver --userenable $ SLURM_JOB_USERAnd that seems to be working.
-
AuthorPosts
This topic was marked as solved, you can't post.