I have an Ubuntu 20.04 Linux setup, with xfce, xorg and xrdp installed. My objective is to run an application inside a graphics environment, do some clicks, monitor its performance, and them close it after some time.
I am able to do it using an RDP session, by running "app.sh" in the terminal on the remote machine. But I would like this process to be more automated, and the app to start using remote ssh, whithout having to do the RDP session. Unfortunately I am not familiar enough with linux to know where to start.
What have I attempted so far:
- Just running "app.sh" from a remote ssh results in "Could not detect graphics environment" error.
- Using "xinit app.sh 'displayconfig'" command. The app seems to run but the app ui does not seem to initialize on the remote machine (or at least I cannot detect it)
For my purposes, I do not care whether or not a display session or rdp session is active (please correct me if I got the terminology wrong). My only objective is to start the app on the remote machine, send a click event to some (X,Y) coords, and then close the app. I do not want to actually see the actual UI.
Edit 1: Expected behavior (for clarity):
- I connect to the remote machine though ssh
- I run some command to start the app on the remote server
- The app starts on the remote server (with the ui and everithing)
- I dont see the UI on the local machine, but it is running on remote
- I send a click event to some (X,Y) coords (I have a python script for that)
- I monitor the performance of the app (the cloud setup does that for me)
- I close the app after some time
- I close the ssh connection
May be relevant: My app is a Java Swing based app, and I am using JVMTI to detect the UI
Edit 2: I will try to explain my setup a bit more, as the answers provided make the wrong assumptions:
I have 2 linux servers: server A and server B. server A acts as a repository (no graphics or anything) where different versions of the same app are uploaded. Once a new version for my app is uploaded, Server A uploaded that version to Server B, and deletes the old version (this part I have figured out). Now server B has some graphics installed. I need Server A to send some command to Server B to start the app as if it was a user (human) using the GUI. Now server A does not have any display, so I cannot forward the gui anywhere. So far, I have an 'app.sh' file with which managed to start the app, using RDP (from a windows machine) to connect. This, unfortunately, is not an option for production. What I need is some way to start a graphics environment on server B from server A and run the app there, or just have some 'always on' session which has a graphics environment on server B, and somehow start my app from server A with that session. I do not actually need the visual feed of the gui, as I dont need to see it, nor will I have any physical display for it, it can be purely virtual/simulated on server B, or it can be missing at all if there is a way to "click a button" without it.
Screenshots (redacted for confidentiality):
What you can see: Open RDP session, App running in background (behind terminal, not as background process), Terminal 2 started the app by calling 'app.sh', Terminal 1 sent a 'list ui' command to the app. All works fine
What can you see: an open SSH connection, attempting to call same 'app.sh' as before.
More info: running 'echo $XDG_CURRENT_DESKTOP':
- in RDP session: > 'XFCE'
- in SSH session: > ''
Would something like this be possible? Please dont hesitate to request additional info
ssh
into the server while having an Xserver running on your local machine and then just start programs on the server, with them appearing locally on your machine? Have you tried this before going down the RDP path? – Ray Aug 22 '22 at 13:37ssh
with an XServer can solve that problem for you... – Ray Aug 22 '22 at 16:22gimp
might allow you to "crop" an image by loading up a GUI and you draw a box around what you want to crop it. The Imagemagick family of programs allow you to crop an image (for example) via the command-line. Here, this is two separate programs, but I can imagine one program being able to do this. But that's up to the developer to make such a program. That sounds like what you're looking for? – Ray Aug 22 '22 at 16:26ssh
into the server and runmyapp &
. It would start up and run in the background. If I change the display to the server's screen instead of my own, it would then pop up there instead of my screen. But if you get errors from this step, then this means the app seems to want/need it to be displayed. Not something to do with Ubuntu (as far as I can tell). – Ray Aug 22 '22 at 17:04