Getting a useful persistent VNC session
By a persistent VNC session, I mean a session that you can connect your VNC viewer to, do stuff, disconnect from, and then later come back to connect to it again. This makes it the graphical equivalent of screen, at least for me.
screen, it also gives you a certain amount of immunity
against network and workstation stability problems for critical tasks
that you don't want interrupted. More and more, systems have to be
managed graphically instead of through text interfaces, which means that
screen isn't good enough.)
VNC generally comes with a program,
vncserver, that starts and manages
VNC sessions, and it even puts them in the background for you. The
magic secret to useful persistent VNC sessions is simple: ignore this
backgrounding and always start vncserver with
vncserver's backgrounding is only doing half the necessary job.
If you don't do this, what happens can be confusing: once you close
the terminal window or log out or whatever from the shell that you
vncserver, all of the client programs get disconnected from
the server, so when you (re)connect to the VNC session all you see
is the plain black and white X background.
vncserver just uses '
&' in the shell to start things
in the background, which doesn't protect them from getting a
when the session exits, and the VNC X server itself reacts to
by terminating all of the current client connections.)
Update: Pete Zaitcev pointed out
in email that people who use normal shells won't see this problem and
should just use plain
nohup et al. The problem
happens for me because I'm using a shell
that doesn't do job control.