Debian – How to start Application in Wine From a terminal window

debianlinuxwine

I am running Wine on a Linux Server so as to run some old Windows Applications.

I now need to write a script to make sure they are running.

Is it possible to create an ssh connection to the server and start the application?

e.g. if I am on the desktop, open a terminal window and run

wine "Z:\home\user\Desktop\application"

the application opens. But If I connect by SSH and run

wine "Z:\home\user\Desktop\application"

I get:

Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
err:systray:initialize_systray Could not create tray window
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly. 

I'm assuming I need to tell it where to start the application rather than just starting it, but can't see how to do this?


ADDITIONAL INFO:

I am currently working on a Windows PC, and connecting with Putty to the Linux/Wine server. (I also have a RDP connection so I can see the desktop).

Long term I will be running the script on another Linux server (MgmtSrv) that will make an ssh connection to the Linux/Wine server to manage it. The MgmtSrv does not have Wine installed, and does not have an X-Display set up.

Best Answer

As you surmise, you need to tell Wine where to display its applications. Since your Wine server has an X display, it's probably :0:

DISPLAY=:0 wine ...

should do the trick (assuming your X authentication cookies are OK; if they're not you'll get an Invalid MIT-MAGIC-COOKIE error).

Related Question