LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 06-10-2009, 08:27 PM   #1
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Rep: Reputation: 1
Question 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.

Last edited by rickhg12hs; 06-11-2009 at 10:12 PM. Reason: clarify, provide example
 
Old 06-11-2009, 07:56 AM   #2
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
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)
 
Old 06-12-2009, 07:52 PM   #3
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by scheidel21 View Post
... 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!
 
Old 06-12-2009, 10:32 PM   #4
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
start the vncserver session with a nohup signal that should keep it running even if the parent process is exited.
 
Old 06-13-2009, 08:06 PM   #5
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by scheidel21 View Post
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.
 
Old 06-13-2009, 08:11 PM   #6
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Question 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.
 
Old 06-13-2009, 09:57 PM   #7
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
If you run ps -aux or pstree after logging out of your intial session do you see everything running that you left running?
 
Old 06-14-2009, 10:49 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 06-14-2009, 10:54 AM   #9
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by scheidel21 View Post
If you run ps -aux or pstree after logging out of your intial session do you see everything running that you left running?
Yes
 
Old 06-14-2009, 10:59 AM   #10
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by unSpawn View Post
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!
 
Old 06-14-2009, 11:53 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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/.
 
Old 06-14-2009, 01:02 PM   #12
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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
 
Old 06-17-2009, 04:54 PM   #13
rickhg12hs
LQ Newbie
 
Registered: Apr 2008
Distribution: RHEL, Fedora, Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 1
Talking

Quote:
Originally Posted by rickhg12hs View Post
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
 
  


Reply

Tags
logout, redhat, rhel, vnc, vncserver, vncviewer, xvnc



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL question about what apps are supported nuzzy Red Hat 1 08-28-2008 08:58 AM
vncserver --- blank desktop after logout?? StamfordRob Linux - Software 1 04-16-2008 07:28 AM
KDE can't launch apps after Kppp, and I cant logout without crashing spiroth10 Linux - Software 2 06-18-2006 08:09 PM
Keeping remote desktop apps active after logout? stefaandk Linux - General 1 05-31-2006 07:47 PM
Robust vncserver startup file (rc.vncserver) arobinson74 Slackware 4 05-14-2005 05:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 12:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration