(Linux) How to run a program of gtk without displa

2019-03-04 02:00发布

I got a program which must run in GTK gui environment. I can only use ssh. This program will run on a server(centos 6) and installed gnome X display.

It's no need to see GUI, but after it run finished, i can get the answer.

VNC and Remote screen is disable.

When i start the program in ssh:

Gtk-WARNING **: cannot open display:

Is there any ways to salve this problem??? I known it's bad to run a gui program in this situation, but here we only discuss technology...

Thank you...

1条回答
霸刀☆藐视天下
2楼-- · 2019-03-04 02:59

The ssh utility has an option -X which enables X11 forwarding.

Have you tried to connect to your destination like that ?

Or the other option is to perform the export DISPLAY=:0.0 after you log-in to your host, then run your app.

This way you'll save some network traffic, will run your app remotely, but the GUI will be displayed on the screen of the remote host.

P.S. Generally speaking your application logic might be invalid if it fails to run GUI. Are you sure that your application will do the expected stuff when it fails to run the GUI ?

查看更多
登录 后发表回答