Run script after connection and after disconnection

Forums / NoMachine for Linux / Run script after connection and after disconnection

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #38448
    respz
    Participant

    Can I run a script (or list of scripts) on the host after a succesful connection and after disconnection? At first, I want to disable the wallpaper and restablish it after I disconnect. Later, I plan to add a few more things.

    #38470
    fisherman
    Moderator

    Please check following link for the additional information about possibility and how to run scripts:
    https://knowledgebase.nomachine.com/DT11R00174#11.5

    #38471
    respz
    Participant

    I did manage to run the scripts I wanted, at least I could see them in the logs. I am running a gsettings command to remove the wallpaper on connection. When I run the script from the command line, it works, but it doesn’t when it is run from the nomachine’s UserScriptAfterSessionStart. I tryd running on the node.cfg and also server.cfg.

    #38476
    Britgirl
    Keymaster

    Some examples of custom scripts are also here, you might find them useful:

    Some examples to use custom scripts triggered on server and node events
    https://knowledgebase.nomachine.com/AR02L00787

    #38499
    Britgirl
    Keymaster

    When I run the script from the command line, it works, but it doesn’t when it is run from the nomachine’s UserScriptAfterSessionStart.

     

    Can you show us the script?

     

     

    #38529
    respz
    Participant

    Sorry for the delayed response. I found out what is happening.

    I have 2 scripts, namely: afterlogin.sh and afterlogout.sh.

    afterlogin contains:

    #!/bin/bash

    gsettings set org.mate.background picture-filename ”

    The problem is that it is run under user nx instead of the logged user. So it cannot get the DBUS_SESSION_BUS_ADDRESS variable from the current gnome session to change the background.

    Is there a way to run scripts as the current logged user, instead of user nx?

    #38590
    fisherman
    Moderator

    Please just add your scripts in the node.cfg file, and it will be executed with current logged user.

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

You must be logged in to reply to this topic.