Custom Script: failed with exit code 8

Forum / NoMachine Cloud Server Products / Custom Script: failed with exit code 8

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27235
    tom5
    Participant

    Hello,

    I’ve just started evaluating Cloud Server and Enterprise Desktop.

    On a Mac server, I’m trying to get a custom script to run with UserScriptAfterSessionDisconnect and UserScriptAfterSessionClose.  The script is to log the user out of the Mac after they have closed or disconnected the session.  The script doesn’t run.  Checking the logs i see ‘…finished with exit code 8’ and ‘…failed on event: after session close’.

    The script is a .sh file (logoutscript.sh) and the contents are:

    osascript -e ‘ignoring application responses’ -e ‘tell application “loginwindow” to «event aevtrlgo»’ -e end

    I’ve given everyone read and write access to the script file, ran chmod +x /NMTMP/logoutscript.sh
    I can run the script from terminal.

    What is exit code 8? Any help or alternative solutions would be much appreciated.

    Thanks

    #27278
    Gega
    Participant

    Hello tom5,

    Please check nxerror.log, it might show more detailed error from script. In order for session

    to work correctly it’s necessary for the custom script to finish with 0.

    It’s enough to use UserScriptAfterSessionClose. Do you set it in node.cfg or server.cfg?

    Please take into account that if you use server.cfg than script will be run as user ‘nx’,

    if you use node.cfg than script will be run as desktop owner.

    There’s also EnableLockScreen key in server.cfg, it’s designed to lock screen when

    user disconnects from physical desktop, if it fits your needs.

    #27351
    tom5
    Participant

    Hello Gega,

    Thank you for the quick reply.

    I’ve now tried it in both node.cfg and server.cfg but still not managed to get it to work unfortunately.  Does ‘exit code 8’ mean anything specific, and help me troubleshoot further?

    I’ve just been playing around with EnableLockScreen.  Whilst we’d prefer a full logout, this is definitely something we can live with, so I’ve enabled it.

    Thanks again.

    Tom

    #28565
    Britgirl
    Keymaster

    Sorry for the late answer. Exit code 8 is output from your Osascript, what does the Osacript manual say 🙂

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

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