Q: How to save the vncserver state? I am happily using vncserver but sometimes it dies, which is a pain. Is it possible to save the state of vncserver so that I can at least have something to resume if it dies?

A: If you are on linux, you could try with "process checkpointing": freezing the vncserver process state every x seconds to disk and then resuming the last snapshot after a crash. There are a couple of tools to do this: DMTCP and Cryopid2. The former explicitly says it can checkpoint GUI desktops and X applications, so there is good hope for the entire vncserver. Good luck and let us know!

A: VNC offers a persistent session option. Exactly how to set it up may depend on the version of VNC you are using, so try SE or Google for instructions specific to your version.
The version I use most is installed on an antique Solaris8 server. It's from RealVNC. From the server you run the evncserver command with your favourite -geometry and -IdleTimeout (and possibly depth). This creates a VNC session with a number at the end such as ":9". Then when you run vnc from the client, specify the :9 at the end of the server identity.
My alias for simplicity is set to:
evncserver -geometry 1280x1024 -IdleTimeout 16200 -depth 24
The session will generally persist until reboot on the server, or you kill the process explicitly from the server. Accessing the session again retains everything as it was, including running processes. Sounds like what you want.
