wine over ssh

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
vijaymk
Newbie
Newbie
Posts: 4
Joined: Wed Apr 22, 2009 5:02 pm

wine over ssh

Post by vijaymk »

Hi all,

I am running wine over ssh (with X forwarding) and I have a problem getting back into the shell after executing an app using wine.

Here's what I am doing:

ssh -X myhost 'wine notepad'

The concern is that I can get back to my shell only after I exit the notepad application. I tried appending an '&' at the end and that did'nt help.

Any help is appreciated.

cheers,
vijay.
Martin Gregorie

wine over ssh

Post by Martin Gregorie »

On Wed, 2009-04-22 at 17:07 -0500, vijaymk wrote:
Hi all,

I am running wine over ssh (with X forwarding) and I have a problem
getting back into the shell after executing an app using wine.
Here's what I am doing:

ssh -X myhost 'wine notepad'

The concern is that I can get back to my shell only after I exit the
notepad application. I tried appending an '&' at the end and that
did'nt help.

Any help is appreciated.
Have you tried using VNC? I just tried it with a WINE application - it
worked with no trouble.

1) Login to the remote host where you run wine with ssh
2) run "vncserver" and take note of the display number it chooses.
At this point you can log out from your ssh session or not,
as you wish.
3) from your local machine, run "/usr/bin/vncviewer -FullColour".
You can run that in a terminal session or put a launcher on
your desktop and click the icon.
4) When prompted, enter "hostname:n" where 'hostname' is the remote
host and 'n' is the display number.
5) You'll be prompted for a password. Enter the password for the login
you started vncserver in.
6) A reduced desktop appears with an open terminal session in it.

7) Use that to run your wine application.

8) When you're done, click the top left corner of the VNC desktop and
select Quit from the menu. The remote desktop closes.

9) You can leave vncserver running a long as you want.
It doesn't use resources if you just leave it running.
When you want to stop it, start an ssh session to the login its
running in and run the command "vncserver -kill :1" to stop the
server.

There are variations on this scheme:
- Once vncviewer has opened a remote desktop you can open as many
windows on it as you want, just like a local desktop.

- By default VNC uses the xfce window manager, which doesn't
show icons or the remote desktop image, but you can configure
it to use Gnome or KDE instead.

- If you prefer, you can run a VNC viewer applet in your web browser
instead of using vncviewer, but its colours aren't as good as you
see on a local terminal or with the vncviewer application, but you
can usually live with that. The advantage is that you can access the
remote host from any OS provided it has a browser that can run a
Java applet.

- You can leave as many copies of vncserver running as you like
in different logins. They all advertise different display numbers,
so each display number selects a different login user.

- You can also start a single, central vncserver via xinetd.
This means that you don't have to log in to start the server.

There's only one gotcha. Its probably not a good idea to use the
vncserver -geometry option to resize its virtual desktop (default is
1024 x 768) if you also access that user from a local console because
VNC mucks about with the Xorg config if you do that.


Martin
vijaymk
Newbie
Newbie
Posts: 4
Joined: Wed Apr 22, 2009 5:02 pm

Re: wine over ssh

Post by vijaymk »

Martin Gregorie wrote:
Have you tried using VNC? I just tried it with a WINE application - it
worked with no trouble.

....

Martin
Thanks for the response. I have no problem running applications; just that I am unable to return to shell until the app is closed. The reason this bugs me is because I need to use this a bunch if times in a shell script, and if I can't get back to shell, my script does not serve its purpose :(
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: wine over ssh

Post by vitamin »

vijaymk wrote:ssh -X myhost 'wine notepad'

The concern is that I can get back to my shell only after I exit the notepad application. I tried appending an '&' at the end and that did'nt help.
That's correct - you asking ssh to login and start that app and not the remote shell.

You have to use nohup and stderr redirection if you want to start Wine program in a background like that. RTFM more about "daemonising" a program - disconnecting it from the terminal and keeping it running. This has nothing to do with Wine but the basics of using *NIX shell.
Martin Gregorie

wine over ssh

Post by Martin Gregorie »

On Wed, 2009-04-22 at 21:04 -0500, vijaymk wrote:
Thanks for the response. I have no problem running applications; just
that I am unable to return to shell until the app is closed.
...which is exactly why I suggested using it. VNC starts up and closes
down fast and doesn't block your ssh session.
The reason this bugs me is because I need to use this a bunch if times
in a shell script, and if I can't get back to shell, my script does
not serve its purpose :(
..but if you run the script in an ssh session and the script runs the
WINE app I'd expect the script to resume execution every time you exit
from the app. Why doesn't it do that?

Are you doing something more devious/convoluted than running a simple
script?

I suggest you open a second ssh session in parallel and run diagnostic
tools, e.g. top, in it to see what's going on in your script.


Martin
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: wine over ssh

Post by vitamin »

Martin Gregorie wrote:...which is exactly why I suggested using it. VNC starts up and closes
down fast and doesn't block your ssh session.
So how will he run a VNC on non-existing X server?
Martin Gregorie

wine over ssh

Post by Martin Gregorie »

On Thu, 2009-04-23 at 09:29 -0500, vitamin wrote:
Martin Gregorie wrote:
...which is exactly why I suggested using it. VNC starts up and closes
down fast and doesn't block your ssh session.
So how will he run a VNC on non-existing X server?
VNC doesn't need an X-server:

- Xvnc (the program launched by the vncserver script) publishes an X
server interface for use by the application and provides a private
VNC service interface for accepting connections as well as an HTTP
server interface for the vnc applet.

- vncviewer comes in an X-aware versions (you run that on *nix hosts)
and a Windows version. Probably there are others too.

- there's also a Java applet that runs in any Java-enabled web browser
that can be used in place of vncviewer.

In short, you can use VNC to run X-applications on a headless server.
That's what it was designed to do.


Martin
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: wine over ssh

Post by vitamin »

Martin Gregorie wrote:- Xvnc (the program launched by the vncserver script) publishes an X
server interface for use by the application and provides a private
VNC service interface for accepting connections as well as an HTTP
server interface for the vnc applet.
Right, you have to start it first. Or there is nothing to vnc into.

VNC or not you still have to "daemonize" the process before you can disconnect. And vnc client connection is not scriptable.

Anyway, it's hard to guess exactly what OP wanted. What his program does, why does he want to run it in background.
Martin Gregorie

wine over ssh

Post by Martin Gregorie »

On Thu, 2009-04-23 at 13:51 -0500, vitamin wrote:
Right, you have to start it first. Or there is nothing to vnc into.
Correct.
VNC or not you still have to "daemonize" the process before you can disconnect. And vnc client connection is not scriptable.
Logging in via ssh to the user you want to access access via VNC,
running "vncserver" and logging out again is enough. VNC stays available
until the next reboot unless you log in again and stop it.
Anyway, it's hard to guess exactly what OP wanted. What his program
does, why does he want to run it in background.
I can't work that out. My first assumption was that he wanted to start
an ssh session and use it to run a script on the remote host: the script
would start a WINE application several times and would use X11
forwarding to display its window(s) on the local machine. Now I'm not so
sure. A re-reading suggests he might want to run a script on his local
machine that starts the WINE app on a remote host.

I've decided I don't understand what he wants to do and will say no more
about it until we hear a clear explanation from him.


Martin
AL3X2
Level 2
Level 2
Posts: 11
Joined: Mon Dec 08, 2008 4:08 pm

Post by AL3X2 »

ssh -X myhost 'nohup wine notepad &'

this will do the trick ;)
vijaymk
Newbie
Newbie
Posts: 4
Joined: Wed Apr 22, 2009 5:02 pm

Post by vijaymk »

i used nohup.. and it worked like charm
sorry.. this should not even have been a wine related post!
vijaymk
Newbie
Newbie
Posts: 4
Joined: Wed Apr 22, 2009 5:02 pm

Re: wine over ssh

Post by vijaymk »

Martin Gregorie wrote: ....
I can't work that out. My first assumption was that he wanted to start
an ssh session and use it to run a script on the remote host: the script
would start a WINE application several times and would use X11
forwarding to display its window(s) on the local machine. Now I'm not so
sure. A re-reading suggests he might want to run a script on his local
machine that starts the WINE app on a remote host.

I've decided I don't understand what he wants to do and will say no more
about it until we hear a clear explanation from him.

Martin
Yes, you are correct. This is what I intend to do.
[#] I ssh into server1, and run a wine application.
[#] With that app running in the background, I ssh into server2 and run another wine app.
[#] This goes on to 10 different servers..
[#] Once an app finishes running (in any server), I need to detect that and re-run the app with slightly different arguments.
.... and I want to script this whole thing :)

I'm still new to shell scripting and i'll RT(F)M to get that going! :)
Locked