I am exporting a several GUIs across a network using X11, I start the GUIs by SSHing into the server with the -X option and running the executable.If the remote machine is abruptly shutdown or the connection is lost the Window on the local machine stops responding and cannot be closed by normal means (such as clicking the close icon in the top right). This happens with a Java Swing GUI and a QT GUI.Is there a X11 or SSH config parameter I can set which will cause the window to close nicely if the connection is lost? Being able to set a timeout would be ideal.
Gracefully Handle Losing Connection Exported X Display
linux;ssh;rhel;x11
You can try the fairly low-level xkill utility, which if given with no args allows you to click on a window of the X11 client you wish to close the connection to. Perhaps your window manager also provides a kill item in its menus.You can configure ssh to detect a lost connection more quickly by editing ~/.ssh/config, on the machine on which you give the ssh command, to end with the lines:# --- all following applies to myserver onlyHost myserverServerAliveCountMax 3ServerAliveInterval 5Use the Host command to restrict the options that follow it to only host myserver. The client will send a message to the server every 5 seconds, and when 3 go withoutreply it will close the connection.