LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   How to get vncserver (Xvnc) and its apps to survive logout nicely???? [RHEL 5.1] (https://www.linuxquestions.org/questions/red-hat-31/how-to-get-vncserver-xvnc-and-its-apps-to-survive-logout-nicely-%5Brhel-5-1%5D-732086/)

rickhg12hs 06-10-2009 08:27 PM

How to get vncserver (Xvnc) and its apps to survive logout nicely???? [RHEL 5.1]
 
Using RHEL 5.1, I would like to login as a regular user, launch vncserver (which seems to be a perl frontend for Xvnc), use vncviewer to launch apps, quit the vncviewer, and logout with all the apps and vncserver running. And then (the part that I haven't made work yet), login as the same user, launch vncviewer and see exactly what I left before logging out.

Using a specially crafted ~/.vnc/xstartup (with a bunch of nohup's), I was able to keep apps running after logout. However, after logging back in and using vncviewer, there is only a blank screen without even a window manager. ps shows that the processes are running and the servers launched within vnc still respond correctly ... I just can't see the GUIs now. I thought that's what vnc would do for me.

Do the launched apps "forget" what X11 server they are using? Is the Xvnc X11 server somehow different after logout/login? Any solutions/recommendations?

[Update to clarify with example]

Here's what I want ...

1. Graphical login as normal user on RHEL 5.1
2. launch Xvnc via vncserver
3. run vncviewer and within its X11 window launch GUI apps (e.g., wireshark, xcalc, etc.)
4. quit vncviewer (no Xvnc logout, etc., just vncviewer quit)
5. logout of original login from step 1.
6. sometime later, graphical login as same normal user on RHEL 5.1 (as in step 1)
7. run vncviewer and see exactly what was present just before step 4.

In addition, everything launched in step 3 continues to run normally regardless of whether vncviewer is running (or not) and regardless of whether normal user is logged in (or not).

The killer seems to be step 5, but surely there is a workaround.

scheidel21 06-11-2009 07:56 AM

Well what you are logging out of is the Desktop environment and/or windows manager that the Xserver presents to you after you start it. Unlike console access when you logout VNC viewer does not go to like a login screen, it leaves the xserver window up with nothing running. In order to do what you want or that it seems you want, you will need to just disconnect from the VNC session, not log of. Or (I have never tried this) maybe you could get the vncserver to run xdm, gdm or kdm and then when you initially connected to the vncserver you would see a user logon, you then log on and then when you logoff the vnc server goes back to the user logon screen. (I have seen this done in tutorials before but it has been a long time)

rickhg12hs 06-12-2009 07:52 PM

Quote:

Originally Posted by scheidel21 (Post 3570372)
... In order to do what you want or that it seems you want, you will need to just disconnect from the VNC session, not log of.

Yes, you are right. I was doing this, but apparently more is required to nicely survive the original login/logout.

I've updated the original post/question to hopefully make the goal (and problem) clearer. Please post any new ideas. Thanks!

scheidel21 06-12-2009 10:32 PM

start the vncserver session with a nohup signal that should keep it running even if the parent process is exited.

rickhg12hs 06-13-2009 08:06 PM

Quote:

Originally Posted by scheidel21 (Post 3572352)
start the vncserver session with a nohup signal that should keep it running even if the parent process is exited.

Actually, vncserver is a perl script that launches Xvnc. I copied the script to a local dir and modified it so that Xvnc is launched with nohup. It does continue to run after logout, however after logging back in and launching vncviewer, it shows just a blank screen without even a window manager.

Something must change with the logout/login such that the X11 apps and/or vncviewer don't know that they are associated.

rickhg12hs 06-13-2009 08:11 PM

How to get vncserver (Xvnc) and its apps to survive logout nicely???? [RHEL 5.1]
 
Using RHEL 5.1, I would like to login as a regular user, launch vncserver (which seems to be a perl frontend for Xvnc), use vncviewer to launch apps, quit the vncviewer, and logout with all the apps and vncserver running. And then (the part that I haven't made work yet), login as the same user, launch vncviewer and see exactly what I left before logging out.

Using a specially crafted ~/.vnc/xstartup (with a bunch of nohup's), I was able to keep apps running after logout. However, after logging back in and using vncviewer, there is only a blank screen without even a window manager. ps shows that the processes are running and the servers launched within vnc still respond correctly ... I just can't see the GUIs now. I thought that's what vnc would do for me.

Do the launched apps "forget" what X11 server they are using? Is the Xvnc X11 server somehow different after logout/login? Any solutions/recommendations?

[Update to clarify with example]

Here's what I want ...

1. Graphical login as normal user on RHEL 5.1
2. launch Xvnc via vncserver
3. run vncviewer and within its X11 window launch GUI apps (e.g., wireshark, xcalc, etc.)
4. quit vncviewer (no Xvnc logout, etc., just vncviewer quit)
5. logout of original login from step 1.
6. sometime later, graphical login as same normal user on RHEL 5.1 (as in step 1)
7. run vncviewer and see exactly what was present just before step 4.

In addition, everything launched in step 3 continues to run normally regardless of whether vncviewer is running (or not) and regardless of whether normal user is logged in (or not).

The killer seems to be step 5, but surely there is a workaround.

scheidel21 06-13-2009 09:57 PM

If you run ps -aux or pstree after logging out of your intial session do you see everything running that you left running?

unSpawn 06-14-2009 10:49 AM

In /etc/sysconfig/vncserver edit VNCSERVERS="1:$USERNAME" and replace USERNAME with any valid unprivileged accountname. Login to the USERNAME account, run 'vncpasswd', log out. Run 'service vncserver start' to see if it works OK. Login to your own account and run vncviewer, provide the password set by running vncpasswd from USERNAMEs account and you're in $USERNAME's session without futher login. Now logging out of $USERNAME's KDE/GNOME/XFCE/whatever else session will close the session but just pressing F8 will only close vncviewer. Logging out of your account, logging back in and running vncviewer should get you back to $USERNAME's session with everything still running.

rickhg12hs 06-14-2009 10:54 AM

Quote:

Originally Posted by scheidel21 (Post 3573123)
If you run ps -aux or pstree after logging out of your intial session do you see everything running that you left running?

Yes

rickhg12hs 06-14-2009 10:59 AM

Quote:

Originally Posted by unSpawn (Post 3573513)
In /etc/sysconfig/vncserver edit VNCSERVERS="1:$USERNAME" and replace USERNAME with any valid unprivileged accountname. Login to the USERNAME account, run 'vncpasswd', log out. Run 'service vncserver start' to see if it works OK. Login to your own account and run vncviewer, provide the password set by running vncpasswd from USERNAMEs account and you're in $USERNAME's session without futher login. Now logging out of $USERNAME's KDE/GNOME/XFCE/whatever else session will close the session but just pressing F8 will only close vncviewer. Logging out of your account, logging back in and running vncviewer should get you back to $USERNAME's session with everything still running.

This sounds like what I was looking for. I'll give it a go tomorrow. Thanks!

unSpawn 06-14-2009 11:53 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is temporarily closed awaiting merge with duplicate http://www.linuxquestions.org/questi...el-5.1-732086/.

tredegar 06-14-2009 01:02 PM

On my server, I have this line in /etc/rc.local just before the final exit 0
Code:

su - tred -c " cd /home/tred && vncserver :1 -geometry 1024x768 -depth 24"
You will have to change the red bits for your username.

It starts a vncserver on display :1 as myself ( tred ) at boot time.
I can connect to it with
Code:

vncviewer server:1
When I am finished, I just close the vnc window. I can then reconnect at any time, and the :1 desktop on the server is as I left it.

HTH

rickhg12hs 06-17-2009 04:54 PM

Quote:

Originally Posted by rickhg12hs (Post 3573521)
This sounds like what I was looking for. I'll give it a go tomorrow. Thanks!

Worked great! Thanks!

BTW, this solution appears to be the "redhat way" of what senior member tredegar suggested in the other thread I started (and was reminded not to do anymore!!!!).

http://www.linuxquestions.org/questi...96#post3573596


All times are GMT -5. The time now is 08:09 PM.